1PHP::Serialization(3) User Contributed Perl DocumentationPHP::Serialization(3)
2
3
4
6 PHP::Serialization - simple flexible means of converting the output of
7 PHP's serialize() into the equivalent Perl memory structure, and vice
8 versa.
9
11 use PHP::Serialization qw(serialize unserialize);
12 my $encoded = serialize({ a => 1, b => 2});
13 my $hashref = unserialize($encoded);
14
16 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.
17
18 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.
19
21 Exportable functions..
22
23 serialize($var)
24 Serializes the memory structure pointed to by $var, and returns a scalar value of encoded data.
25
26 NOTE: Will recursively encode objects, hashes, arrays, etc.
27
28 SEE ALSO: ->encode()
29
30 unserialize($encoded,[optional CLASS])
31 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.
32
33 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)
34
35 SEE ALSO: ->decode()
36
38 Functionality available if using the object interface..
39
40 decode($encoded_string,[optional CLASS])
41 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.
42
43 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)
44
45 SEE ALSO: unserialize()
46
47 encode($reference)
48 Serializes the memory structure pointed to by $var, and returns a scalar value of encoded data.
49
50 NOTE: Will recursively encode objects, hashes, arrays, etc.
51
52 SEE ALSO: serialize()
53
55 None known yet, feel free to report some!
56
58 Make faster! (and more efficent?)
59
61 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.
62
63
64
65perl v5.12.0 2004-02-23 PHP::Serialization(3)