1PHP::Serialization(3) User Contributed Perl DocumentationPHP::Serialization(3)
2
3
4

NAME

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

SYNOPSIS

11           use PHP::Serialization qw(serialize unserialize);
12           my $encoded = serialize({ a => 1, b => 2});
13           my $hashref = unserialize($encoded);
14

DESCRIPTION

16       Provides a simple, quick means of serializing perl memory structures
17       (including object data!) into a format that PHP can deserialize() and
18       access, and vice versa.
19
20       NOTE: Converts PHP arrays into Perl Arrays when the PHP array used
21       exclusively numeric indexes, and into Perl Hashes then the PHP array
22       did not.
23

FUNCTIONS

25       Exportable functions..
26
27   serialize($var,[optional $asString,[optional $sortHashes]])
28       Serializes the memory structure pointed to by $var, and returns a
29       scalar value of encoded data.
30
31       If the optional $asString is true, $var will be encoded as string if it
32       is double or float.
33
34       If the optional $sortHashes is true, all hashes will be sorted before
35       serialization.
36
37       NOTE: Will recursively encode objects, hashes, arrays, etc.
38
39       SEE ALSO: ->encode()
40
41   unserialize($encoded,[optional CLASS])
42       Deserializes the encoded data in $encoded, and returns a value (be it a
43       hashref, arrayref, scalar, etc) representing the data structure
44       serialized in $encoded_string.
45
46       If the optional CLASS is specified, any objects are blessed into
47       CLASS::$serialized_class. Otherwise, O bjects are blessed into
48       PHP::Serialization::Object::$serialized_class. (which has no methods)
49
50       SEE ALSO: ->decode()
51

METHODS

53       Functionality available if using the object interface..
54
55   decode($encoded_string,[optional CLASS])
56       Deserializes the encoded data in $encoded, and returns a value (be it a
57       hashref, arrayref, scalar, etc) representing the data structure
58       serialized in $encoded_string.
59
60       If the optional CLASS is specified, any objects are blessed into
61       CLASS::$serialized_class. Otherwise, Objects are blessed into
62       PHP::Serialization::Object::$serialized_class. (which has no methods)
63
64       SEE ALSO: unserialize()
65
66   encode($reference,[optional $asString,[optional $sortHashes]])
67       Serializes the memory structure pointed to by $reference, and returns a
68       scalar value of encoded data.
69
70       If the optional $asString is true, $reference will be encoded as string
71       if it is double or float.
72
73       If the optional $sortHashes is true, all hashes will be sorted before
74       serialization.
75
76       NOTE: Will recursively encode objects, hashes, arrays, etc.
77
78       SEE ALSO: serialize()
79

TODO

81       Support diffrent object types
82

AUTHOR INFORMATION

84       Copyright (c) 2003 Jesse Brown <jbrown@cpan.org>. All rights reserved.
85       This program is free software; you can redistribute it and/or modify it
86       under the same terms as Perl itself.
87
88       Various patches contributed by assorted authors on rt.cpan.org (as
89       detailed in Changes file).
90
91       Currently maintained by Tomas Doran <bobtfish@bobtfish.net>.
92
93       Rewritten to solve all known bugs by Bjørn-Olav Strand <bolav@cpan.org>
94

POD ERRORS

96       Hey! The above document had some coding errors, which are explained
97       below:
98
99       Around line 480:
100           Non-ASCII character seen before =encoding in 'Bjørn-Olav'. Assuming
101           UTF-8
102
103
104
105perl v5.30.0                      2019-07-26             PHP::Serialization(3)
Impressum