[Bps-public-commit] r14926 - in Data-Plist: . lib/Data/Plist lib/Data/Plist/Foundation lib/Foundation t

alexmv at bestpractical.com alexmv at bestpractical.com
Fri Aug 8 13:39:03 EDT 2008


Author: alexmv
Date: Fri Aug  8 13:39:03 2008
New Revision: 14926

Added:
   Data-Plist/lib/Data/Plist/Foundation/
      - copied from r14445, /Data-Plist/lib/Foundation/
Removed:
   Data-Plist/lib/Foundation/
Modified:
   Data-Plist/   (props changed)
   Data-Plist/META.yml
   Data-Plist/lib/Data/Plist.pm
   Data-Plist/lib/Data/Plist/BinaryWriter.pm
   Data-Plist/lib/Data/Plist/Foundation/LibraryToDo.pm
   Data-Plist/lib/Data/Plist/Foundation/NSArray.pm
   Data-Plist/lib/Data/Plist/Foundation/NSData.pm
   Data-Plist/lib/Data/Plist/Foundation/NSDate.pm
   Data-Plist/lib/Data/Plist/Foundation/NSMutableArray.pm
   Data-Plist/lib/Data/Plist/Foundation/NSMutableData.pm
   Data-Plist/lib/Data/Plist/Foundation/NSMutableString.pm
   Data-Plist/lib/Data/Plist/Foundation/NSObject.pm
   Data-Plist/lib/Data/Plist/Foundation/NSString.pm
   Data-Plist/lib/Data/Plist/Foundation/NSURL.pm
   Data-Plist/lib/Data/Plist/Foundation/ToDo.pm
   Data-Plist/lib/Data/Plist/Foundation/ToDoAlarm.pm
   Data-Plist/lib/Data/Plist/Foundation/ToDoAlarms.pm
   Data-Plist/lib/Data/Plist/Writer.pm
   Data-Plist/t/binary-object.t

Log:
 r35546 at kohr-ah:  chmrr | 2008-08-08 13:38:55 -0400
  * Move Foundation:: to Data::Plist::Foundation:: so we don't pollute the namespace


Modified: Data-Plist/META.yml
==============================================================================
--- Data-Plist/META.yml	(original)
+++ Data-Plist/META.yml	Fri Aug  8 13:39:03 2008
@@ -1,5 +1,5 @@
 --- 
-abstract: ~
+abstract: object representing a property list
 author: 
   - Alex Vandiver <alexmv at mit.edu>
 distribution_type: module

Modified: Data-Plist/lib/Data/Plist.pm
==============================================================================
--- Data-Plist/lib/Data/Plist.pm	(original)
+++ Data-Plist/lib/Data/Plist.pm	Fri Aug  8 13:39:03 2008
@@ -45,8 +45,9 @@
 capability to recognize property lists which were generated using
 C<NSKeyedArchiver>, and to construct perl objects based on the
 information in the property list.  Objects thus created are blessed
-under the C<Foundation> namespace.  Thus, the root ancestor of all
-Objective C objects thus imported is L<Foundation::NSObject>.
+under the C<Data::Plist::Foundation> namespace.  Thus, the root
+ancestor of all Objective C objects thus imported is
+L<Data::Plist::Foundation::NSObject>.
 
 =cut
 
@@ -215,11 +216,11 @@
             and ref $class eq "HASH"
             and $class->{'$classname'} )
         {
-            my $classname = "Foundation::" . $class->{'$classname'};
+            my $classname = "Data::Plist::Foundation::" . $class->{'$classname'};
             if ( not $classname->require ) {
                 warn "Can't require $classname: $@\n";
-            } elsif ( not $classname->isa( "Foundation::NSObject" ) ) {
-                warn "$classname isn't a Foundation::NSObject\n";
+            } elsif ( not $classname->isa( "Data::Plist::Foundation::NSObject" ) ) {
+                warn "$classname isn't a Data::Plist::Foundation::NSObject\n";
             } else {
                 bless( $hash, $classname );
                 $hash = $hash->replacement;
@@ -244,15 +245,15 @@
 
 If the plist is an Objective C object archive created with
 C<NSKeyedArchiver> (see L</KEYED ARCHIVES>), returns the object
-blessed into the corresponding class under L<Foundation::NSOjbect>.
-Otherwise, returns undef.
+blessed into the corresponding class under
+L<Data::Plist::Foundation::NSOjbect>.  Otherwise, returns undef.
 
 =cut
 
 sub object {
     my $self   = shift;
 
-    require Foundation::NSObject;
+    require Data::Plist::Foundation::NSObject;
 
     return unless $self->is_archive;
     return $self->reify( $self->collapse( $self->_raw_object ) );

Modified: Data-Plist/lib/Data/Plist/BinaryWriter.pm
==============================================================================
--- Data-Plist/lib/Data/Plist/BinaryWriter.pm	(original)
+++ Data-Plist/lib/Data/Plist/BinaryWriter.pm	Fri Aug  8 13:39:03 2008
@@ -101,6 +101,7 @@
     my ($arrayref) = @_;
     my $type       = $arrayref->[0];
     my $method     = "write_" . $type;
+    local $Storable::canonical = 1;
     my $digest = eval { Digest::MD5::md5_hex( Storable::freeze($arrayref) ) };
     die "Can't $method" unless $self->can($method);
     $self->{objcache}{$digest} = $self->$method( $arrayref->[1] )

Modified: Data-Plist/lib/Data/Plist/Foundation/LibraryToDo.pm
==============================================================================
--- /Data-Plist/lib/Foundation/LibraryToDo.pm	(original)
+++ Data-Plist/lib/Data/Plist/Foundation/LibraryToDo.pm	Fri Aug  8 13:39:03 2008
@@ -1,9 +1,9 @@
-package Foundation::LibraryToDo;
+package Data::Plist::Foundation::LibraryToDo;
 
 use strict;
 use warnings;
 
-use base qw/Foundation::ToDo Class::Accessor/;
+use base qw/Data::Plist::Foundation::ToDo Class::Accessor/;
 
 my %mapping = (
     alarms       => "ToDo Alarms",

Modified: Data-Plist/lib/Data/Plist/Foundation/NSArray.pm
==============================================================================
--- /Data-Plist/lib/Foundation/NSArray.pm	(original)
+++ Data-Plist/lib/Data/Plist/Foundation/NSArray.pm	Fri Aug  8 13:39:03 2008
@@ -1,9 +1,9 @@
-package Foundation::NSArray;
+package Data::Plist::Foundation::NSArray;
 
 use strict;
 use warnings;
 
-use base qw/Foundation::NSObject/;
+use base qw/Data::Plist::Foundation::NSObject/;
 
 1;
 

Modified: Data-Plist/lib/Data/Plist/Foundation/NSData.pm
==============================================================================
--- /Data-Plist/lib/Foundation/NSData.pm	(original)
+++ Data-Plist/lib/Data/Plist/Foundation/NSData.pm	Fri Aug  8 13:39:03 2008
@@ -1,9 +1,9 @@
-package Foundation::NSData;
+package Data::Plist::Foundation::NSData;
 
 use strict;
 use warnings;
 
-use base qw/Foundation::NSObject/;
+use base qw/Data::Plist::Foundation::NSObject/;
 
 1;
 

Modified: Data-Plist/lib/Data/Plist/Foundation/NSDate.pm
==============================================================================
--- /Data-Plist/lib/Foundation/NSDate.pm	(original)
+++ Data-Plist/lib/Data/Plist/Foundation/NSDate.pm	Fri Aug  8 13:39:03 2008
@@ -1,9 +1,9 @@
-package Foundation::NSDate;
+package Data::Plist::Foundation::NSDate;
 
 use strict;
 use warnings;
 
-use base qw/Foundation::NSObject DateTime/;
+use base qw/Data::Plist::Foundation::NSObject DateTime/;
 
 sub replacement {
     my $self = shift;

Modified: Data-Plist/lib/Data/Plist/Foundation/NSMutableArray.pm
==============================================================================
--- /Data-Plist/lib/Foundation/NSMutableArray.pm	(original)
+++ Data-Plist/lib/Data/Plist/Foundation/NSMutableArray.pm	Fri Aug  8 13:39:03 2008
@@ -1,9 +1,9 @@
-package Foundation::NSMutableArray;
+package Data::Plist::Foundation::NSMutableArray;
 
 use strict;
 use warnings;
 
-use base qw/Foundation::NSArray/;
+use base qw/Data::Plist::Foundation::NSArray/;
 
 sub serialize {
     my $self = shift;

Modified: Data-Plist/lib/Data/Plist/Foundation/NSMutableData.pm
==============================================================================
--- /Data-Plist/lib/Foundation/NSMutableData.pm	(original)
+++ Data-Plist/lib/Data/Plist/Foundation/NSMutableData.pm	Fri Aug  8 13:39:03 2008
@@ -1,9 +1,9 @@
-package Foundation::NSMutableData;
+package Data::Plist::Foundation::NSMutableData;
 
 use strict;
 use warnings;
 
-use base qw/Foundation::NSData/;
+use base qw/Data::Plist::Foundation::NSData/;
 use Data::Plist::BinaryWriter;
 
 sub data {

Modified: Data-Plist/lib/Data/Plist/Foundation/NSMutableString.pm
==============================================================================
--- /Data-Plist/lib/Foundation/NSMutableString.pm	(original)
+++ Data-Plist/lib/Data/Plist/Foundation/NSMutableString.pm	Fri Aug  8 13:39:03 2008
@@ -1,9 +1,9 @@
-package Foundation::NSMutableString;
+package Data::Plist::Foundation::NSMutableString;
 
 use strict;
 use warnings;
 
-use base qw/Foundation::NSString/;
+use base qw/Data::Plist::Foundation::NSString/;
 
 sub replacement {
     my $self = shift;

Modified: Data-Plist/lib/Data/Plist/Foundation/NSObject.pm
==============================================================================
--- /Data-Plist/lib/Foundation/NSObject.pm	(original)
+++ Data-Plist/lib/Data/Plist/Foundation/NSObject.pm	Fri Aug  8 13:39:03 2008
@@ -1,4 +1,4 @@
-package Foundation::NSObject;
+package Data::Plist::Foundation::NSObject;
 
 use strict;
 use warnings;
@@ -21,14 +21,14 @@
     $self = ref $self if ref $self;
 
     my $short = $self;
-    $short =~ s/^Foundation:://;
+    $short =~ s/^Data::Plist::Foundation:://;
     return [
         UID => [
             dict => {
                 '$classes' => [
                     array => [
-                        map { s/^Foundation:://; [ string => $_ ] }
-                            grep { $_->isa("Foundation::NSObject") }
+                        map { s/^Data::Plist::Foundation:://; [ string => $_ ] }
+                            grep { $_->isa("Data::Plist::Foundation::NSObject") }
                             Class::ISA::self_and_super_path($self)
                     ]
                 ],

Modified: Data-Plist/lib/Data/Plist/Foundation/NSString.pm
==============================================================================
--- /Data-Plist/lib/Foundation/NSString.pm	(original)
+++ Data-Plist/lib/Data/Plist/Foundation/NSString.pm	Fri Aug  8 13:39:03 2008
@@ -1,8 +1,8 @@
-package Foundation::NSString;
+package Data::Plist::Foundation::NSString;
 
 use strict;
 use warnings;
 
-use base qw/Foundation::NSObject/;
+use base qw/Data::Plist::Foundation::NSObject/;
 
 1;

Modified: Data-Plist/lib/Data/Plist/Foundation/NSURL.pm
==============================================================================
--- /Data-Plist/lib/Foundation/NSURL.pm	(original)
+++ Data-Plist/lib/Data/Plist/Foundation/NSURL.pm	Fri Aug  8 13:39:03 2008
@@ -1,9 +1,9 @@
-package Foundation::NSURL;
+package Data::Plist::Foundation::NSURL;
 
 use strict;
 use warnings;
 
-use base qw/Foundation::NSObject URI::http/;
+use base qw/Data::Plist::Foundation::NSObject URI::http/;
 
 sub replacement {
     my $self = shift;

Modified: Data-Plist/lib/Data/Plist/Foundation/ToDo.pm
==============================================================================
--- /Data-Plist/lib/Foundation/ToDo.pm	(original)
+++ Data-Plist/lib/Data/Plist/Foundation/ToDo.pm	Fri Aug  8 13:39:03 2008
@@ -1,9 +1,9 @@
-package Foundation::ToDo;
+package Data::Plist::Foundation::ToDo;
 
 use strict;
 use warnings;
 
-use base qw/Foundation::NSObject/;
+use base qw/Data::Plist::Foundation::NSObject/;
 
 1;
 

Modified: Data-Plist/lib/Data/Plist/Foundation/ToDoAlarm.pm
==============================================================================
--- /Data-Plist/lib/Foundation/ToDoAlarm.pm	(original)
+++ Data-Plist/lib/Data/Plist/Foundation/ToDoAlarm.pm	Fri Aug  8 13:39:03 2008
@@ -1,9 +1,9 @@
-package Foundation::ToDoAlarm;
+package Data::Plist::Foundation::ToDoAlarm;
 
 use strict;
 use warnings;
 
-use base qw/Foundation::NSObject/;
+use base qw/Data::Plist::Foundation::NSObject/;
 
 sub serialize {
     my $self = shift;

Modified: Data-Plist/lib/Data/Plist/Foundation/ToDoAlarms.pm
==============================================================================
--- /Data-Plist/lib/Foundation/ToDoAlarms.pm	(original)
+++ Data-Plist/lib/Data/Plist/Foundation/ToDoAlarms.pm	Fri Aug  8 13:39:03 2008
@@ -1,9 +1,9 @@
-package Foundation::ToDoAlarms;
+package Data::Plist::Foundation::ToDoAlarms;
 
 use strict;
 use warnings;
 
-use base qw/Foundation::NSObject/;
+use base qw/Data::Plist::Foundation::NSObject/;
 
 1;
 

Modified: Data-Plist/lib/Data/Plist/Writer.pm
==============================================================================
--- Data-Plist/lib/Data/Plist/Writer.pm	(original)
+++ Data-Plist/lib/Data/Plist/Writer.pm	Fri Aug  8 13:39:03 2008
@@ -29,6 +29,7 @@
 use strict;
 use warnings;
 use Storable;
+use Digest::MD5;
 use Scalar::Util;
 
 =head1 METHODS
@@ -98,7 +99,7 @@
     my $data = shift;
 
     if ( $data->[0] eq "UID" ) {
-        require Digest::MD5;
+        local $Storable::canonical = 1;
         my $digest = Digest::MD5::md5_hex( Storable::freeze( $data->[1] ) );
         if ( exists $self->{objcache}{$digest} ) {
             return [ UID => $self->{objcache}{$digest} ];
@@ -140,7 +141,7 @@
             my %hash = %{$value};
             $hash{$_} = $self->serialize_value( $hash{$_} ) for keys %hash;
             return [ dict => \%hash ];
-        } elsif ( $value->isa("Foundation::NSObject") ) {
+        } elsif ( $value->isa("Data::Plist::Foundation::NSObject") ) {
             return $value->serialize;
         } elsif ( $value->isa("DateTime") ) {
             return [ date => $value->epoch - 978307200

Modified: Data-Plist/t/binary-object.t
==============================================================================
--- Data-Plist/t/binary-object.t	(original)
+++ Data-Plist/t/binary-object.t	Fri Aug  8 13:39:03 2008
@@ -5,15 +5,15 @@
 
 use Data::Plist::BinaryReader;
 use Data::Plist::BinaryWriter;
-use Foundation::NSObject;
+use Data::Plist::Foundation::NSObject;
 use YAML;
 
 my $ret;
 my $read = Data::Plist::BinaryReader->new;
 my $p    = $read->open_file("t/data/todo.plist");
-my $o    = $p->object;    # Should return a Foundation::LibraryTodo, which
-                                        # isa Foundation::NSObject
-isa_ok( $o, "Foundation::NSObject" );
+my $o    = $p->object; # Should return a Data::Plist::Foundation::LibraryTodo,
+                       # which isa Data::Plist::Foundation::NSObject
+isa_ok( $o, "Data::Plist::Foundation::NSObject" );
 my $s = Data::Plist::BinaryWriter->write($o);    # Returns a binary plist
 ok( $s, "Write successful." );
 my $r = $read->open_string($s);



More information about the Bps-public-commit mailing list