Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Storable

Native Rust implementation built into the interpreter. Runtime: PP. See original documentation for the full Perl reference.

Provides serialization/deserialization functions for Perl data structures. This module implements a subset of Storable’s functionality compatible with common use cases.

Synopsis

use Storable qw(freeze thaw dclone store retrieve);
my $frozen = freeze(\%hash);
my $thawed = thaw($frozen);
store(\%hash, '/tmp/data.storable');
my $data = retrieve('/tmp/data.storable');
my $copy = dclone(\@deep_structure);

Functions

dclone

Deep-clone a Perl data structure (freeze + thaw in one step). Handles circular references.

use Storable 'dclone';
my $copy = dclone(\%original);

fd_retrieve

Deserialize a data structure from an open filehandle.

file_magic

Return a hash describing the Storable file format magic of a given file.

freeze

Serialize a Perl data structure into a binary string (in-memory). Uses native byte order.

use Storable 'freeze';
my $serialized = freeze(\%hash);

lock_nstore

Locking variants of store, nstore, and retrieve (currently aliases without actual locking).

lock_retrieve

Locking variants of store, nstore, and retrieve (currently aliases without actual locking).

lock_store

Locking variants of store, nstore, and retrieve (currently aliases without actual locking).

nfreeze

Serialize a Perl data structure into a binary string using network (big-endian) byte order for portability across architectures.

use Storable 'nfreeze';
my $portable = nfreeze(\@array);

nstore

Serialize a data structure and write it to a file using network byte order.

nstore_fd

Serialize a data structure to an open filehandle (native or network byte order).

read_magic

Return a hash describing the Storable format magic from a binary string header.

recursion_limit

Get or set the maximum recursion depth for serialization/deserialization.

recursion_limit_hash

Get or set the maximum recursion depth for serialization/deserialization.

retrieve

Read a file written by store/nstore and deserialize it back into a data structure.

use Storable 'retrieve';
my $data = retrieve('/tmp/data.storable');

stack_depth

Get or set the maximum recursion depth for serialization/deserialization.

stack_depth_hash

Get or set the maximum recursion depth for serialization/deserialization.

store

Serialize a data structure and write it to a file. Uses native byte order.

use Storable 'store';
store(\%hash, '/tmp/data.storable');

store_fd

Serialize a data structure to an open filehandle (native or network byte order).

thaw

Deserialize a binary string (produced by freeze or nfreeze) back into a Perl data structure.

use Storable 'thaw';
my $data = thaw($serialized);