.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "PHP::Serialization 3pm" .TH PHP::Serialization 3pm "2018-02-17" "perl v5.26.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" PHP::Serialization \- simple flexible means of converting the output of PHP's serialize() into the equivalent Perl memory structure, and vice versa. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use PHP::Serialization qw(serialize unserialize); \& my $encoded = serialize({ a => 1, b => 2}); \& my $hashref = unserialize($encoded); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Provides a simple, quick means of serializing perl memory structures (including object data!) into a format that \s-1PHP\s0 can \fIdeserialize()\fR and access, and vice versa. .PP \&\s-1NOTE:\s0 Converts \s-1PHP\s0 arrays into Perl Arrays when the \s-1PHP\s0 array used exclusively numeric indexes, and into Perl Hashes then the \s-1PHP\s0 array did not. .SH "FUNCTIONS" .IX Header "FUNCTIONS" Exportable functions.. .ie n .SS "serialize($var,[optional $asString,[optional $sortHashes]])" .el .SS "serialize($var,[optional \f(CW$asString\fP,[optional \f(CW$sortHashes\fP]])" .IX Subsection "serialize($var,[optional $asString,[optional $sortHashes]])" Serializes the memory structure pointed to by \f(CW$var\fR, and returns a scalar value of encoded data. .PP If the optional \f(CW$asString\fR is true, \f(CW$var\fR will be encoded as string if it is double or float. .PP If the optional \f(CW$sortHashes\fR is true, all hashes will be sorted before serialization. .PP \&\s-1NOTE:\s0 Will recursively encode objects, hashes, arrays, etc. .PP \&\s-1SEE ALSO:\s0 \->\fIencode()\fR .SS "unserialize($encoded,[optional \s-1CLASS\s0])" .IX Subsection "unserialize($encoded,[optional CLASS])" Deserializes the encoded data in \f(CW$encoded\fR, and returns a value (be it a hashref, arrayref, scalar, etc) representing the data structure serialized in \f(CW$encoded_string\fR. .PP If the optional \s-1CLASS\s0 is specified, any objects are blessed into CLASS::$serialized_class. Otherwise, O bjects are blessed into PHP::Serialization::Object::$serialized_class. (which has no methods) .PP \&\s-1SEE ALSO:\s0 \->\fIdecode()\fR .SH "METHODS" .IX Header "METHODS" Functionality available if using the object interface.. .SS "decode($encoded_string,[optional \s-1CLASS\s0])" .IX Subsection "decode($encoded_string,[optional CLASS])" Deserializes the encoded data in \f(CW$encoded\fR, and returns a value (be it a hashref, arrayref, scalar, etc) representing the data structure serialized in \f(CW$encoded_string\fR. .PP If the optional \s-1CLASS\s0 is specified, any objects are blessed into CLASS::$serialized_class. Otherwise, Objects are blessed into PHP::Serialization::Object::$serialized_class. (which has no methods) .PP \&\s-1SEE ALSO:\s0 \fIunserialize()\fR .ie n .SS "encode($reference,[optional $asString,[optional $sortHashes]])" .el .SS "encode($reference,[optional \f(CW$asString\fP,[optional \f(CW$sortHashes\fP]])" .IX Subsection "encode($reference,[optional $asString,[optional $sortHashes]])" Serializes the memory structure pointed to by \f(CW$reference\fR, and returns a scalar value of encoded data. .PP If the optional \f(CW$asString\fR is true, \f(CW$reference\fR will be encoded as string if it is double or float. .PP If the optional \f(CW$sortHashes\fR is true, all hashes will be sorted before serialization. .PP \&\s-1NOTE:\s0 Will recursively encode objects, hashes, arrays, etc. .PP \&\s-1SEE ALSO:\s0 \fIserialize()\fR .SH "TODO" .IX Header "TODO" Support diffrent object types .SH "AUTHOR INFORMATION" .IX Header "AUTHOR INFORMATION" Copyright (c) 2003 Jesse Brown . All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP Various patches contributed by assorted authors on rt.cpan.org (as detailed in Changes file). .PP Currently maintained by Tomas Doran . .PP Rewritten to solve all known bugs by Bjørn\-Olav Strand