[Bps-public-commit] r14524 - in Data-Plist: .

kyoki at bestpractical.com kyoki at bestpractical.com
Fri Jul 25 15:20:54 EDT 2008


Author: kyoki
Date: Fri Jul 25 15:20:54 2008
New Revision: 14524

Modified:
   Data-Plist/   (props changed)
   Data-Plist/lib/Data/Plist/BinaryWriter.pm
   Data-Plist/lib/Data/Plist/Writer.pm

Log:
 r30052 at nyx:  kyoki | 2008-07-25 15:20:37 -0400
 * small changes to BinaryWriter's documentation
 * POD for Writer


Modified: Data-Plist/lib/Data/Plist/BinaryWriter.pm
==============================================================================
--- Data-Plist/lib/Data/Plist/BinaryWriter.pm	(original)
+++ Data-Plist/lib/Data/Plist/BinaryWriter.pm	Fri Jul 25 15:20:54 2008
@@ -16,8 +16,8 @@
 
 =head1 DESCRIPTION
 
-C<Data::Plist::BinaryWriter> takes serialized perl data
-structures (see L<Data::Plist/Serialized data>) and
+C<Data::Plist::BinaryWriter> takes perl data structures,
+serializes them (see L<Data::Plist/Serialized data>) and
 recursively writes to a given filehandle in Apple's binary
 property list format.
 
@@ -37,7 +37,7 @@
 
 =head2 write_fh $fh, $data
 
-Takes a serialized data structure C<$data> (see
+Takes a perl data structure C<$data>, serializes it (see
 L<Data::Plist/Serialized data>) and writes it to the given
 filehandle C<$fh> in Apple's binary property list format.
 

Modified: Data-Plist/lib/Data/Plist/Writer.pm
==============================================================================
--- Data-Plist/lib/Data/Plist/Writer.pm	(original)
+++ Data-Plist/lib/Data/Plist/Writer.pm	Fri Jul 25 15:20:54 2008
@@ -1,15 +1,59 @@
+=head1 NAME
+
+Data::Plist::Writer - Object serializer and abstact
+superclass for BinaryWriter and XMLWriter
+
+=head1 SYNOPSIS
+
+ # Create new
+ Data::Plist::BinaryWriter->new;
+
+ # Writing to a string ($ret is binary output)
+ my $ret = $write->write($data);
+
+ # Writing to a file C<$filename>
+ $write->write($filename, $data);
+
+=head1 DESCRIPTION
+
+C<Data::Plist::Writer> is the abstract superclass of
+BinaryWriter and XMLWriter. It takes perl data structures,
+serializes them (see L<Data::Plist/Serialized data>), and
+recursively writes to a given filehandle in the desired
+format.
+
+=cut
+
 package Data::Plist::Writer;
 
 use strict;
 use warnings;
 use Scalar::Util;
 
+=head1 METHODS
+
+=cut
+
+=head2 new
+
+Abstract method that creates a new writer.
+
+=cut
+
 sub new {
     my $class = shift;
     my %args = ( serialize => 1, @_ );
     return bless \%args => $class;
 }
 
+=head2 write $filehandle, $object
+
+Takes a perl data structure C<$object> and writes to the
+given filehandle C<$filehandle>. Can also write to a string
+if C<$filehandle> is not defined.
+
+=cut
+
 sub write {
     my $self   = shift;
     my $object = pop;
@@ -31,6 +75,15 @@
     return;
 }
 
+=head2 fold_uids $data
+
+Takes a slightly modified Cbjective C iCal data structure
+C<$data> unfolds it, assigning UIDs to its
+contents. Returns a nested collection of arrays formatted
+for writing.
+
+=cut
+
 sub fold_uids {
     my $self = shift;
     my $data = shift;
@@ -55,6 +108,13 @@
     }
 }
 
+=head2 serialize_value $data
+
+Takes a perl data structure C<$data> and turns it into a
+series of nested arrays of the format [datatype => data] in
+preparation for writing.
+
+=cut
 sub serialize_value {
     my $self = shift;
     my ($value) = @_;
@@ -87,6 +147,13 @@
     }
 }
 
+=head2 serialize $data
+
+Takes a data structure C<$data> and determines what sort of
+serialization it should go through.
+
+=cut
+
 sub serialize {
     my $self   = shift;
     my $object = shift;



More information about the Bps-public-commit mailing list