PHP::Serialization - simple flexible means of converting the output of PHP's serialize() into the equivalent Perl memory structure, and vice versa.
use PHP::Serialization qw(serialize unserialize); my $encoded = serialize({ a => 1, b => 2}); my $hashref = unserialize($encoded);
Provides a simple, quick means of serializing perl memory structures (including object data!) into a format that PHP can deserialize() and access, and vice versa. NOTE: Converts PHP arrays into Perl Arrays when the PHP array used exclusively numeric indexes, and into Perl Hashes then the PHP array did not.
Exportable functions..
Serializes the memory structure pointed to by $var, and returns a scalar value of encoded data. NOTE: Will recursively encode objects, hashes, arrays, etc. SEE ALSO: ->encode()
Deserializes the encoded data in $encoded, and returns a value (be it a hashref, arrayref, scalar, etc) representing the data structure serialized in $encoded_string. If the optional CLASS is specified, any objects are blessed into CLASS::$serialized_class. Otherwise, Objects are blessed into PHP::Serialization::Object::$serialized_class. (which has no methods) SEE ALSO: ->decode()
Functionality available if using the object interface..
Deserializes the encoded data in $encoded, and returns a value (be it a hashref, arrayref, scalar, etc) representing the data structure serialized in $encoded_string. If the optional CLASS is specified, any objects are blessed into CLASS::$serialized_class. Otherwise, Objects are blessed into PHP::Serialization::Object::$serialized_class. (which has no methods) SEE ALSO: unserialize()
Serializes the memory structure pointed to by $var, and returns a scalar value of encoded data. NOTE: Will recursively encode objects, hashes, arrays, etc. SEE ALSO: serialize()
None known yet, feel free to report some!
Make faster! (and more efficent?)
Copyright (c) 2003 Jesse Brown <jbrown@cpan.org>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install PHP::Serialization, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PHP::Serialization
CPAN shell
perl -MCPAN -e shell install PHP::Serialization
For more information on module installation, please visit the detailed CPAN module installation guide.