NAME

Data::Plist::Writer - Object serializer and abstact superclass for BinaryWriter and XMLWriter

SYNOPSIS

# Create new
my $write = Data::Plist::BinaryWriter->new;

# Writing to a string ($ret is binary output)
my $ret = $write->write($data);

# Writing to a file C<$filename>
$ret = $write->write($filename, $data);

DESCRIPTION

Data::Plist::Writer is the abstract superclass of Data::Plist::BinaryWriter and Data::Plist::XMLWriter. It takes perl data structures, serializes them (see "SERIALIZED DATA" in Data::Plist), and recursively writes to a given filehandle in the desired format.

METHODS

new

Creates a new writer. 'serialize' is set to 1 since it's assumed that data being passed in will be perl data structures that need to be serialized. Users may set it to 0 when creating a writer if they wish to use preserialized data.

write $filehandle, $data

write $filename, $data

write $data

Takes a perl data structure $data and writes to the given filehandle $filehandle, or filename $filename. If only the $data is provided, returns the data to be written, as a string.

fold_uids $data

Takes a serialized object $data (see "SERIALIZED DATA" in Data::Plist) and rewrites it as a keyed archive (see "KEYED ARCHIVES" in Data::Plist) by folding on UIDs.

serialize_value $data

Takes a perl data structure $data and turns it into a series of nested arrays of the format [datatype => data] (see "SERIALIZED DATA" in Data::Plist) in preparation for writing. This is an internal data structure that should be immediately handed off to a writer.

serialize $data

Takes a data structure $data and determines what sort of serialization it should go through.

Objects wishing to provide their own serializations should have a 'serialize' method, which should return something in the internal structure mentioned above (see also "SERIALIZED DATA" in Data::Plist).