nstore_fd#
Serialise a referenced structure in network byte order and write it to an open filehandle.
Σύνοψη#
use Storable qw(nstore_fd fd_retrieve);
open my $fh, ">", "portable.bin" or die $!;
nstore_fd(\%data, $fh);
Τι επιστρέφεται#
Returns 1 on success. Emits a length-prefixed payload - same framing as store_fd - whose body is a portable (network-order) serialisation. The matching reader is fd_retrieve, which detects byte order automatically.
Παραδείγματα#
Ship a record to a remote host over a pipe:
open my $out, ">&", \*STDOUT or die $!;
nstore_fd(\%payload, $out);
Οριακές περιπτώσεις#
First argument must be a reference; croaks with
Not a referenceotherwise.If the filehandle has no usable file descriptor, the call succeeds silently without writing. Check the handle first if that matters.
Διαφορές από το upstream#
Uses the same 4-byte little-endian length-prefix framing as
store_fd; upstream Storable does not. Pinned byt/81-xs-native/Storable/080-fd.t.
Δείτε επίσης#
fd_retrieve- matching reader.store_fd- faster same-architecture variant.nstore- write portable bytes to a named file.nfreeze- return portable bytes instead of writing.