Persistence for Perl data structures

Edit Package perl-Storable
http://search.cpan.org/dist/Storable/

The Storable package brings persistence to your Perl data structures
containing SCALAR, ARRAY, HASH or REF objects, i.e. anything that can be
conveniently stored to disk and retrieved at a later time.

It can be used in the regular procedural way by calling 'store' with a
reference to the object to be stored, along with the file name where the
image should be written.

The routine returns 'undef' for I/O problems or other internal error, a
true value otherwise. Serious errors are propagated as a 'die' exception.

To retrieve data stored to disk, use 'retrieve' with a file name. The
objects stored into that file are recreated into memory for you, and a
_reference_ to the root object is returned. In case an I/O error occurs
while reading, 'undef' is returned instead. Other serious errors are
propagated via 'die'.

Since storage is performed recursively, you might want to stuff references
to objects that share a lot of common data into a single array or hash
table, and then store that object. That way, when you retrieve back the
whole thing, the objects will continue to share what they originally
shared.

At the cost of a slight header overhead, you may store to an already opened
file descriptor using the 'store_fd' routine, and retrieve from a file via
'fd_retrieve'. Those names aren't imported by default, so you will have to
do that explicitly if you need those routines. The file descriptor you
supply must be already opened, for read if you're going to retrieve and for
write if you wish to store.

store_fd(\%table, *STDOUT) || die "can't store to stdout\n";
$hashref = fd_retrieve(*STDIN);

You can also store data in network order to allow easy sharing across
multiple platforms, or when storing on a socket known to be remotely
connected. The routines to call have an initial 'n' prefix for _network_,
as in 'nstore' and 'nstore_fd'. At retrieval time, your data will be
correctly restored so you don't have to know whether you're restoring from
native or network ordered data. Double values are stored stringified to
ensure portability as well, at the slight risk of loosing some precision in
the last decimals.

When using 'fd_retrieve', objects are retrieved in sequence, one object
(i.e. one recursive tree) per associated 'store_fd'.

If you're more from the object-oriented camp, you can inherit from Storable
and directly store your objects by invoking 'store' as a method. The fact
that the root of the to-be-stored tree is a blessed reference (i.e. an
object) is special-cased so that the retrieve does not provide a reference
to that object but rather the blessed object reference itself. (Otherwise,
you'd get a reference to that blessed object).

Refresh
Refresh
Source Files
Filename Size Changed
Storable-3.25.tar.gz 0000251331 245 KB
cpanspec.yml 0000000923 923 Bytes
perl-Storable.changes 0000012767 12.5 KB
perl-Storable.spec 0000004182 4.08 KB
Latest Revision
Marcello Barnaba's avatar Marcello Barnaba (vjt) accepted request 917042 from Tina Müller's avatar Tina Müller (tinita) (revision 5)
- updated to 3.25
   see /usr/share/doc/packages/perl-Storable/ChangeLog
  2021-08-30 07:46:52 nwclark
      version 3.25
          * No changes from previous version
  2021-08-25 08:05:16 nwclark
      version 3.24_50
          * Remove code and tests only present to support perls before 5.6.1
            Storable implicitly needs >= v5.6.1.
          * Use SvPVCLEAR from ppport.h
          * Remove XS code "commented" out with #if 0
          * Refactor store_lhash() to remove some code duplication
          * Avoid calling hv_iterval() twice for each hash entry
          * Fix a bug in the recursion depth check in store_lhash()
  unreleased
      version 3.24
          * Fix a (possible) typo in Sntohl
  unreleased
      version 3.23
          * Fix typos
          * avoid stderr noise in t/canonical.t
  2020-07-31 19:36:37 atoomic
      version 3.22
          * use PERL_COMPARE macros
  2020-04-23 13:33:05 ilmari
      version 3.21
          * fix repeated-word typos
          * fix t/huge.t PERL_TEST_MEMORY diagnostic messages
  2020-01-27 10:27:00 TonyC
      version 3.20
          * fix a format string and arguments for some debugging text
          * linkify references to alternatives to Storable
  2020-01-27 11:01:00 TonyC
      version 3.19
          * add casts to match some I32 parameters to "%d" formats (#17339)
          * fix dependencies in Makefile.PL -> META (#17422)
          * make use of note() optional, this requires a newer version of
            Test::More and there's a circular dependency between later
            versions of Test::More and Storable  (#17422)
  2019-11-19 07:59:39 TonyC
      version 3.18
          * update bug tracker to point at github (#17298)
          * disallow vstring magic strings over 2GB-1 (#17306)
          * mark some ASCII dependent tests as ASCII platform only
  2019-08-08 11:48:00 TonyC
      version 3.17
          * correct a data type to ensure the check for too large results from
  	  STORABLE_freeze() are detected correctly (detected by Coverity)
  	* removed remains of stack size detection from the build process.
  	* moved CAN_FLOCK detection into XS to simplify the build process.
  2019-06-11 10:43:00 TonyC
      version 3.16
          * (perl #134179) fix self-referencing structures that include regexps
          * bless regexps to preserve bless qr//, "Foo"
Comments 0
openSUSE Build Service is sponsored by