GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
PDL::IO::Storable(3) User Contributed Perl Documentation PDL::IO::Storable(3)

PDL::IO::Storable - helper functions to make PDL usable with serialisation packages

  use Storable;
  use PDL::IO::Storable;
  $hash = {
            'foo' => 42,
            'bar' => zeroes(23,45),
          };
  store $hash, 'perlhash.dat';
  use JSON::MaybeXS;
  $encoder = JSON::MaybeXS->new(allow_tags => 1);
  my $ndarray = xvals (5,2);
  my $encoded_json = $encoder->encode ($ndarray);
  my $decoded_ndarray = $encoder->decode ($encoded_json);

Serialisation packages such as "Storable", "Sereal", "JSON::MaybeXS" and "CBOR::XS" implement object persistence for Perl data structures that can contain arbitrary Perl objects. This module implements the relevant methods to be able to store and retrieve ndarrays via "Storable" as well as packages that support the Types::Serialiser protocol (currently Sereal, CBOR::XS and JSON packages).

Note that packages supporting the "Types::Serialiser" protocol need to have their respective flags enabled so that the FREEZE and THAW callbacks are used.

Note also that while JSON::MaybeXS is supported, if it has to fall back to JSON::PP, it will fail. JSON::XS treats the data it gets back from "FREEZE" as items to encode, while JSON::PP treats the list it gets as strings already encoded. They are fundamentally incompatible, so this module supports the JSON::XS option.

Finally, data flow is not preserved. If a data structure containing ndarrays connected by data flow is serialised then this will need to be explicitly reinstated on deserialisation.

store an ndarray using Storable

  $x = random 12,10;
  $x->store('myfile');

freeze an ndarray using Storable

  $x = random 12,10;
  $frozen = $x->freeze;

Copyright (C) 2013 Dima Kogan <dima@secretsauce.net> Copyright (C) 2002 Christian Soeller <c.soeller@auckland.ac.nz> All rights reserved. There is no warranty. You are allowed to redistribute this software / documentation under certain conditions. For details, see the file COPYING in the PDL distribution. If this file is separated from the PDL distribution, the copyright notice should be included in the file.

2025-01-19 perl v5.40.2

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.