Hello community, here is the log from the commit of package perl-Mac-PropertyList for openSUSE:Factory checked in at 2020-10-10 00:27:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Mac-PropertyList (Old) and /work/SRC/openSUSE:Factory/.perl-Mac-PropertyList.new.4249 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Mac-PropertyList" Sat Oct 10 00:27:52 2020 rev:18 rq:839563 version:1.501 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Mac-PropertyList/perl-Mac-PropertyList.changes 2018-04-19 15:26:50.913523964 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Mac-PropertyList.new.4249/perl-Mac-PropertyList.changes 2020-10-10 00:27:58.101111885 +0200 @@ -1,0 +2,12 @@ +Sun Oct 4 03:15:23 UTC 2020 - Tina Müller <timueller+p...@suse.de> + +- updated to 1.501 + see /usr/share/doc/packages/perl-Mac-PropertyList/Changes + + 1.501 2020-09-30T04:50:46Z + * Added create_plist_from_string() + * Merged Tom Wyant's code to handle CF$UID types + * A few more things emit warnings if they don't get the right type + * $XML_{head,foot} are now subroutines + +------------------------------------------------------------------- Old: ---- Mac-PropertyList-1.413.tar.gz New: ---- Mac-PropertyList-1.501.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Mac-PropertyList.spec ++++++ --- /var/tmp/diff_new_pack.o39lQr/_old 2020-10-10 00:27:59.701112678 +0200 +++ /var/tmp/diff_new_pack.o39lQr/_new 2020-10-10 00:27:59.701112678 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-Mac-PropertyList # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,25 +12,25 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: perl-Mac-PropertyList -Version: 1.413 +Version: 1.501 Release: 0 %define cpan_name Mac-PropertyList -Summary: Work with Mac Plists at a Low Level +Summary: Work with Mac plists at a low level License: Artistic-2.0 Group: Development/Libraries/Perl -Url: http://search.cpan.org/dist/Mac-PropertyList/ +URL: https://metacpan.org/release/%{cpan_name} Source0: https://cpan.metacpan.org/authors/id/B/BD/BDFOY/%{cpan_name}-%{version}.tar.gz Source1: cpanspec.yml BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros -BuildRequires: perl(Test::More) >= 0.94 +BuildRequires: perl(Test::More) >= 1 BuildRequires: perl(XML::Entities) BuildRequires: perl(parent) Requires: perl(XML::Entities) @@ -62,11 +62,11 @@ %setup -q -n %{cpan_name}-%{version} %build -%{__perl} Makefile.PL INSTALLDIRS=vendor -%{__make} %{?_smp_mflags} +perl Makefile.PL INSTALLDIRS=vendor +make %{?_smp_mflags} %check -%{__make} test +make test %install %perl_make_install ++++++ Mac-PropertyList-1.413.tar.gz -> Mac-PropertyList-1.501.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mac-PropertyList-1.413/Changes new/Mac-PropertyList-1.501/Changes --- old/Mac-PropertyList-1.413/Changes 2018-03-22 19:51:21.000000000 +0100 +++ new/Mac-PropertyList-1.501/Changes 2020-09-30 06:52:18.000000000 +0200 @@ -1,5 +1,11 @@ Revision history for Perl module Mac::PropertyList +1.501 2020-09-30T04:50:46Z + * Added create_plist_from_string() + * Merged Tom Wyant's code to handle CF$UID types + * A few more things emit warnings if they don't get the right type + * $XML_{head,foot} are now subroutines + 1.413 2018-03-22T18:51:07Z * Update to Artistic License 2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mac-PropertyList-1.413/MANIFEST new/Mac-PropertyList-1.501/MANIFEST --- old/Mac-PropertyList-1.413/MANIFEST 2018-03-22 19:51:22.000000000 +0100 +++ new/Mac-PropertyList-1.501/MANIFEST 2020-09-30 06:52:22.000000000 +0200 @@ -14,6 +14,7 @@ MANIFEST.SKIP plists/binary.plist plists/binary2.plist +plists/binary_uids.plist plists/com.apple.iPhoto.plist plists/com.apple.iTunes.plist plists/com.apple.systempreferences.plist @@ -39,6 +40,7 @@ t/pod_coverage.t t/read_binary.t t/scalar.t +t/string.t t/test_manifest t/time.t t/write.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mac-PropertyList-1.413/MANIFEST.SKIP new/Mac-PropertyList-1.501/MANIFEST.SKIP --- old/Mac-PropertyList-1.413/MANIFEST.SKIP 2018-03-22 19:51:21.000000000 +0100 +++ new/Mac-PropertyList-1.501/MANIFEST.SKIP 2020-09-30 06:52:18.000000000 +0200 @@ -65,3 +65,7 @@ Mac-\.* \.swp$ \.patch$ +\.github/ +MANIFEST\s\d +CHANGES\s\d + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mac-PropertyList-1.413/META.json new/Mac-PropertyList-1.501/META.json --- old/Mac-PropertyList-1.413/META.json 2018-03-22 19:51:22.000000000 +0100 +++ new/Mac-PropertyList-1.501/META.json 2020-09-30 06:52:21.968155212 +0200 @@ -4,13 +4,13 @@ "brian d foy <bd...@cpan.org>" ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010", "license" : [ "artistic_2" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", - "version" : "2" + "version" : 2 }, "name" : "Mac-PropertyList", "no_index" : { @@ -42,7 +42,7 @@ }, "test" : { "requires" : { - "Test::More" : "0.94" + "Test::More" : "1" } } }, @@ -58,6 +58,6 @@ "web" : "https://github.com/briandfoy/mac-propertylist" } }, - "version" : "1.413", - "x_serialization_backend" : "JSON::PP version 2.27400_02" + "version" : "1.501", + "x_serialization_backend" : "JSON::PP version 4.02" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mac-PropertyList-1.413/META.yml new/Mac-PropertyList-1.501/META.yml --- old/Mac-PropertyList-1.413/META.yml 2018-03-22 19:51:22.000000000 +0100 +++ new/Mac-PropertyList-1.501/META.yml 2020-09-30 06:52:21.431024512 +0200 @@ -3,12 +3,12 @@ author: - 'brian d foy <bd...@cpan.org>' build_requires: - Test::More: '0.94' + Test::More: '1' configure_requires: ExtUtils::MakeMaker: '6.64' File::Spec::Functions: '0' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150010' +generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010' license: artistic_2 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -30,5 +30,5 @@ bugtracker: https://github.com/briandfoy/mac-propertylist/issues homepage: https://github.com/briandfoy/mac-propertylist repository: https://github.com/briandfoy/mac-propertylist.git -version: '1.413' +version: '1.501' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mac-PropertyList-1.413/Makefile.PL new/Mac-PropertyList-1.501/Makefile.PL --- old/Mac-PropertyList-1.413/Makefile.PL 2018-03-22 19:51:21.000000000 +0100 +++ new/Mac-PropertyList-1.501/Makefile.PL 2020-09-30 06:52:18.000000000 +0200 @@ -49,7 +49,7 @@ 'NAME' => $module, 'ABSTRACT_FROM' => $main_file, 'VERSION_FROM' => $main_file, - 'LICENSE' => 'artistic2', + 'LICENSE' => 'artistic_2', 'AUTHOR' => 'brian d foy <bd...@cpan.org>', 'CONFIGURE_REQUIRES' => { @@ -61,7 +61,7 @@ }, 'TEST_REQUIRES' => { - 'Test::More' => '0.94', + 'Test::More' => '1', }, 'PREREQ_PM' => { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mac-PropertyList-1.413/README.pod new/Mac-PropertyList-1.501/README.pod --- old/Mac-PropertyList-1.413/README.pod 2018-03-22 19:51:21.000000000 +0100 +++ new/Mac-PropertyList-1.501/README.pod 2020-09-30 06:52:18.000000000 +0200 @@ -10,7 +10,7 @@ =for HTML <a href="https://github.com/briandfoy/mac-propertylist/blob/master/LICENSE"><img src="https://img.shields.io/cpan/l/Mac-PropertyList.svg" /></a> -=for HTML <a href="http://www.metacpan.org/module/Mac::PropertyList"><img src="https://img.shields.io/cpan/v/Mac-PropertyList.svg" /></A> +=for HTML <a href="https://metacpan.org/pod/Mac::PropertyList"><img src="https://img.shields.io/cpan/v/Mac-PropertyList.svg" /></A> =head1 The Mac::PropertyList module @@ -25,7 +25,7 @@ To read about L<Mac::PropertyList>, look at the embedded documentation in the module itself. Inside the distribution, you can format it -with L<perldoc|http://perldoc.perl.org/perldoc.html>: +with L<perldoc|https://perldoc.perl.orgperldoc.html>: % perldoc lib/Mac/PropertyList.pm @@ -34,17 +34,8 @@ % perldoc Mac::PropertyList -You can read the documentation and inspect the meta data on one of the -CPAN web interfaces, such as L<CPAN Search|http://search.cpan.org/dist/Mac-PropertyList> or -L<MetaCPAN|http://www.metacpan.org/module/Mac::PropertyList>: - -=over 4 - -=item * L<http://search.cpan.org/dist/Mac-PropertyList> - -=item * L<http://www.metacpan.org/module/Mac::PropertyList> - -=back +You can read the documentation and inspect the meta data at +L<MetaCPAN|https://metacpan.org/pod/Mac::PropertyList>. The standard module documentation has example uses in the SYNOPSIS section, but you can also look in the I<examples/> directory (if it's diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mac-PropertyList-1.413/lib/Mac/PropertyList/ReadBinary.pm new/Mac-PropertyList-1.501/lib/Mac/PropertyList/ReadBinary.pm --- old/Mac-PropertyList-1.413/lib/Mac/PropertyList/ReadBinary.pm 2018-03-22 19:51:21.000000000 +0100 +++ new/Mac-PropertyList-1.501/lib/Mac/PropertyList/ReadBinary.pm 2020-09-30 06:52:18.000000000 +0200 @@ -13,7 +13,7 @@ use POSIX qw(SEEK_END SEEK_SET); use XML::Entities (); -$VERSION = '1.413'; +$VERSION = '1.501'; __PACKAGE__->_run( @ARGV ) unless caller; @@ -298,6 +298,18 @@ return Mac::PropertyList::ustring->new( $buffer ); }, + 8 => sub { # UIDs + my( $self, $length ) = @_; + + my $byte_length = $length + 1; + + read $self->_fh, ( my $buffer ), $byte_length; + + my $value = unpack 'H*', $buffer; + + return Mac::PropertyList::uid->new( $value ); + }, + a => sub { # array my( $self, $elements ) = @_; @@ -390,9 +402,11 @@ brian d foy, C<< <bd...@cpan.org> >> +Tom Wyant added support for UID types. + =head1 COPYRIGHT AND LICENSE -Copyright © 2004-2018, brian d foy <bd...@cpan.org>. All rights reserved. +Copyright © 2004-2020, brian d foy <bd...@cpan.org>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mac-PropertyList-1.413/lib/Mac/PropertyList/WriteBinary.pm new/Mac-PropertyList-1.501/lib/Mac/PropertyList/WriteBinary.pm --- old/Mac-PropertyList-1.413/lib/Mac/PropertyList/WriteBinary.pm 2018-03-22 19:51:21.000000000 +0100 +++ new/Mac-PropertyList-1.501/lib/Mac/PropertyList/WriteBinary.pm 2020-09-30 06:52:18.000000000 +0200 @@ -6,6 +6,7 @@ use Encode (); use Mac::PropertyList (); +use Math::BigInt; use Exporter qw(import); =encoding utf8 @@ -18,8 +19,8 @@ use Mac::PropertyList::WriteBinary; - my $data = new Mac::PropertyList::dict({ ... => ... }); - my $buf = Mac::PropertyList::WriteBinary::as_string($data); + my $data = Mac::PropertyList::dict->new( { ... => ... } ); + my $buf = Mac::PropertyList::WriteBinary::as_string($data); =head1 DESCRIPTION @@ -406,6 +407,17 @@ } } +package Mac::PropertyList::uid; + +use constant tagUID => Mac::PropertyList::WriteBinary->tagUID; + +sub _as_bplist_fragment { + my( $value ) = $_[0]->value; + + # TODO what about UIDs longer than 16 bytes? Or are there none? + return pack 'CH*', tagUID + length( $value ) / 2 - 1, $value; +} + package Mac::PropertyList::string; sub _as_bplist_fragment { @@ -442,7 +454,9 @@ Wim Lewis, C<< <w...@cpan.org> >> -Copyright © 2012-2014 Wim Lewis. All rights reserved. +Copyright © 2012-2014 Wim Lewis. All rights reserved. + +Tom Wyant added support for UID types. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mac-PropertyList-1.413/lib/Mac/PropertyList.pm new/Mac-PropertyList-1.501/lib/Mac/PropertyList.pm --- old/Mac-PropertyList-1.413/lib/Mac/PropertyList.pm 2018-03-22 19:51:21.000000000 +0100 +++ new/Mac-PropertyList-1.501/lib/Mac/PropertyList.pm 2020-09-30 06:52:18.000000000 +0200 @@ -4,7 +4,7 @@ use warnings; no warnings; -use vars qw($ERROR $XML_head $XML_foot $VERSION @EXPORT_OK %EXPORT_TAGS); +use vars qw($ERROR $VERSION @EXPORT_OK %EXPORT_TAGS); use Carp qw(croak carp); use Data::Dumper; use XML::Entities; @@ -18,13 +18,14 @@ plist_as_string create_from_hash create_from_array + create_from_string ); %EXPORT_TAGS = ( 'all' => \@EXPORT_OK, ); -$VERSION = '1.413'; +$VERSION = '1.501'; =encoding utf8 @@ -112,6 +113,7 @@ Mac::PropertyList::data Mac::PropertyList::real Mac::PropertyList::integer + Mac::PropertyList::uid Mac::PropertyList::date Mac::PropertyList::array Mac::PropertyList::dict @@ -153,16 +155,6 @@ my $Debug = $ENV{PLIST_DEBUG} || 0; -$XML_head =<<"XML"; -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -XML - -$XML_foot =<<"XML"; -</plist> -XML - my %Readers = ( "dict" => \&read_dict, "string" => \&read_string, @@ -186,6 +178,8 @@ use Mac::PropertyList qw( :all ); +=head2 Things that parse + =over 4 =item parse_plist( TEXT ) @@ -288,9 +282,12 @@ sub create_from_hash { my $hash = shift; - return unless UNIVERSAL::isa( $hash, 'HASH' ); + unless( ref $hash eq ref {} ) { + carp "create_from_hash did not get an hash reference"; + return; + } - my $string = "$XML_head" . Mac::PropertyList::dict->write_open . "\n"; + my $string = XML_head() . Mac::PropertyList::dict->write_open . "\n"; foreach my $key ( keys %$hash ) { next if ref $hash->{$key}; @@ -305,7 +302,7 @@ $string .= $bit; } - $string .= Mac::PropertyList::dict->write_close . "\n$XML_foot"; + $string .= Mac::PropertyList::dict->write_close . "\n" . XML_foot(); return $string; } @@ -324,9 +321,12 @@ sub create_from_array { my $array = shift; - return unless UNIVERSAL::isa( $array, 'ARRAY' ); + unless( ref $array eq ref [] ) { + carp "create_from_array did not get an array reference"; + return; + } - my $string = "$XML_head" . Mac::PropertyList::array->write_open . "\n"; + my $string = XML_head() . Mac::PropertyList::array->write_open . "\n"; foreach my $element ( @$array ) { my $value = Mac::PropertyList::string->new( $element ); @@ -337,11 +337,52 @@ $string .= $bit; } - $string .= Mac::PropertyList::array->write_close . "\n$XML_foot"; + $string .= Mac::PropertyList::array->write_close . "\n" . XML_foot(); return $string; } +=item create_from_string( STRING ) + +Returns a string representing the string in the plist format. + +=cut + +sub create_from_string { + my $string = shift; + + unless( ! ref $string ) { + carp "create_from_string did not get a string"; + return; + } + + return + XML_head() . + Mac::PropertyList::string->new( $string )->write . + "\n" . XML_foot(); + } + +=item create_from + +Dispatches to either C<create_from_array>, C<create_from_hash>, or +C<create_from_string> based on the argument. If none of those fit, +this C<croak>s. + +=cut + +sub create_from { + my $thingy = shift; + + return do { + if( ref $thingy eq ref [] ) { &create_from_array } + elsif( ref $thingy eq ref {} ) { &create_from_hash } + elsif( ! ref $thingy eq ref {} ) { &create_from_string } + else { + croak "Did not recognize argument! Must be a string, or reference to a hash or array"; + } + }; + } + =item read_string =item read_data @@ -439,7 +480,13 @@ } $source->put_line( $_ ); - return Mac::PropertyList::dict->new( \%hash ); + if ( 1 == keys %hash && exists $hash{'CF$UID'} ) { + # This is how plutil represents a UID in XML. + return Mac::PropertyList::uid->integer( $hash{'CF$UID'}->value ); + } + else { + return Mac::PropertyList::dict->new( \%hash ); + } } =item read_array @@ -474,6 +521,38 @@ return Mac::PropertyList::data->new( $string ); } +=back + +=head2 Things that write + +=over 4 + +=item XML_head + +Returns a string that represents the start of the PList XML. + +=cut + +sub XML_head () { + <<"XML"; +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +XML + } + +=item XML_foot + +Returns a string that represents the end of the PList XML. + +=cut + +sub XML_foot () { + <<"XML"; +</plist> +XML + } + =item plist_as_string Return the plist data structure as XML in the Mac Property List format. @@ -483,11 +562,11 @@ sub plist_as_string { my $object = CORE::shift; - my $string = $XML_head; + my $string = XML_head(); $string .= $object->write . "\n"; - $string .= $XML_foot; + $string .= XML_foot(); return $string; } @@ -502,6 +581,10 @@ sub plist_as_perl { $_[0]->as_perl } +=back + +=cut + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # package Mac::PropertyList::Source; sub new { @@ -782,6 +865,74 @@ use base qw(Mac::PropertyList::Scalar); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +package Mac::PropertyList::uid; +use base qw(Mac::PropertyList::Scalar); + +# The following is conservative, since the actual largest unsigned +# integer is ~0, which is 0xFFFFFFFFFFFFFFFF on many (most?) modern +# Perls; but it is consistent with Mac::PropertyList::ReadBinary. +# This is really just future-proofing though, since it appears from +# CFBinaryPList.c that a UID is carried as a hard-coded uint32_t. +use constant LONGEST_HEX_REPRESENTABLE_AS_NATIVE => 8; # 4 bytes + +# Instantiate with hex string. The string will be padded on the left +# with zero if its length is odd. It is this string which will be +# returned by value(). Presence of a non-hex character causes an +# exception. We default the argument to '00'. +sub new { + my ( $class, $value ) = @_; + $value = '00' unless defined $value; + Carp::croak( 'uid->new() argument must be hexadecimal' ) + if $value =~ m/ [[:^xdigit:]] /smx; + substr $value, 0, 0, '0' + if length( $value ) % 2; + return $class->SUPER::new( $value ); + } + +# Without argument, this is an accessor returning the value as an unsigned +# integer, either a native Perl value or a Math::BigInt as needed. +# With argument, this is a mutator setting the value to the hex +# representation of the argument, which must be an unsigned integer, +# either native Perl of Math::BigInt object. If called as static method +# instantiates a new object. +sub integer { + my ( $self, $integer ) = @_; + if ( @_ < 2 ) { + my $value = $self->value(); + return length( $value ) > LONGEST_HEX_REPRESENTABLE_AS_NATIVE ? + Math::BigInt->from_hex( $value ) : + hex $value; + } + else { + Carp::croak( 'uid->integer() argument must be unsigned' ) + if $integer < 0; + my $value = ref $integer ? + $integer->to_hex() : + sprintf '%x', $integer; + if ( ref $self ) { + substr $value, 0, 0, '0' + if length( $value ) % 2; + ${ $self } = $value; + } + else { + $self = $self->new( $value ); + } + return $self; + } + } + +# This is how plutil represents a UID in XML. +sub write { + my $self = shift; + my $dict = Mac::PropertyList::dict->new( { + 'CF$UID' => Mac::PropertyList::integer->new( + $self->integer ), + } + ); + return $dict->write(); + } + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # package Mac::PropertyList::string; use base qw(Mac::PropertyList::Scalar); @@ -833,8 +984,6 @@ use base qw(Mac::PropertyList::Boolean); -=back - =head1 SOURCE AVAILABILITY This project is in Github: @@ -867,9 +1016,11 @@ brian d foy, C<< <bd...@cpan.org> >> +Tom Wyant added support for UID types. + =head1 COPYRIGHT AND LICENSE -Copyright © 2004-2018, brian d foy <bd...@cpan.org>. All rights reserved. +Copyright © 2004-2020, brian d foy <bd...@cpan.org>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. Binary files old/Mac-PropertyList-1.413/plists/binary_uids.plist and new/Mac-PropertyList-1.501/plists/binary_uids.plist differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mac-PropertyList-1.413/t/load.t new/Mac-PropertyList-1.501/t/load.t --- old/Mac-PropertyList-1.413/t/load.t 2018-03-22 19:51:21.000000000 +0100 +++ new/Mac-PropertyList-1.501/t/load.t 2020-09-30 06:52:18.000000000 +0200 @@ -1,8 +1,11 @@ -BEGIN { @classes = qw(Mac::PropertyList Mac::PropertyList::ReadBinary) } +BEGIN { @classes = qw( + Mac::PropertyList + Mac::PropertyList::ReadBinary + Mac::PropertyList::WriteBinary + ) } use Test::More tests => scalar @classes; -foreach my $class ( @classes ) - { - print "bail out! $class did not compile\n" unless use_ok( $class ); +foreach my $class ( @classes ) { + BAIL_OUT( "$class did not compile\n" ) unless use_ok( $class ); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mac-PropertyList-1.413/t/plists.t new/Mac-PropertyList-1.501/t/plists.t --- old/Mac-PropertyList-1.413/t/plists.t 2018-03-22 19:51:21.000000000 +0100 +++ new/Mac-PropertyList-1.501/t/plists.t 2020-09-30 06:52:18.000000000 +0200 @@ -35,6 +35,10 @@ my $elapsed = Time::HiRes::tv_interval( $time1, $time2 ); diag( "$file [$b bytes] parsed in $elapsed seconds" ); - # All of the test plists have a dict at the top level, except for binary2. - isa_ok( $plist, ( $file eq 'plists/binary2.plist' ) ? 'ARRAY' : 'HASH' ); + # All of the test plists have a dict at the top level, except + # for binary2 and binary_uids. + isa_ok( $plist, { + 'plists/binary2.plist' => 'ARRAY', + 'plists/binary_uids.plist' => 'ARRAY', + }->{$file} || 'HASH' ); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mac-PropertyList-1.413/t/read_binary.t new/Mac-PropertyList-1.501/t/read_binary.t --- old/Mac-PropertyList-1.413/t/read_binary.t 2018-03-22 19:51:21.000000000 +0100 +++ new/Mac-PropertyList-1.501/t/read_binary.t 2020-09-30 06:52:18.000000000 +0200 @@ -7,7 +7,7 @@ binmode STDOUT, ':encoding(utf-8)'; } -use Test::More tests => 41; +use Test::More tests => 51; use File::Spec::Functions; @@ -153,3 +153,24 @@ } } + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# Test UIDs +{ + note 'Testing UID input'; + + my $test_file = catfile( qw{ plists binary_uids.plist } ); + my $plist = parse_plist_file( $test_file ); + + isa_ok( $plist, 'Mac::PropertyList::array' ); + + my @expect = qw{ 01 2a 04d2 0074cbb1 }; + my @values = $plist->value(); + is( scalar @values, scalar @expect, 'Right number of elements in array' ); + + for my $index ( 0 .. $#expect ) { + isa_ok( $values[$index], 'Mac::PropertyList::uid' ); + is( $values[$index]->value, $expect[$index], + "uid at index $index has right value" ); + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mac-PropertyList-1.413/t/scalar.t new/Mac-PropertyList-1.501/t/scalar.t --- old/Mac-PropertyList-1.413/t/scalar.t 2018-03-22 19:51:21.000000000 +0100 +++ new/Mac-PropertyList-1.501/t/scalar.t 2020-09-30 06:52:18.000000000 +0200 @@ -1,4 +1,4 @@ -use Test::More tests => 23; +use Test::More tests => 28; use Mac::PropertyList; @@ -36,6 +36,24 @@ } ######################################################################## +# Test the uid bits +my $uid = Mac::PropertyList::uid->new(); +isa_ok( $uid, "Mac::PropertyList::uid" ); + +{ +my $value = 37; +$string = Mac::PropertyList::uid->integer( $value ); +isa_ok( $string, "Mac::PropertyList::uid" ); +is( $string->value, sprintf '%x', $value ); +is( $string->type, 'uid' ); +# Per plutil, this is the xml1 representation of a UID. +is( $string->write, "<dict> + <key>CF\$UID</key> + <integer>$value</integer> +</dict>" ); +} + +######################################################################## # Test the string bits my $string = Mac::PropertyList::string->new(); isa_ok( $string, "Mac::PropertyList::string" ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mac-PropertyList-1.413/t/string.t new/Mac-PropertyList-1.501/t/string.t --- old/Mac-PropertyList-1.413/t/string.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Mac-PropertyList-1.501/t/string.t 2020-09-30 06:52:18.000000000 +0200 @@ -0,0 +1,32 @@ +use Test::More tests => 3; + +use Mac::PropertyList; + +######################################################################## +# Test the string bits +subtest empty_object => sub { + my $string = Mac::PropertyList::string->new(); + isa_ok( $string, "Mac::PropertyList::string", 'Make empty object' ); + }; + +subtest parse => sub { + my $plist = <<"HERE"; +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<string>Mimi</string> +</plist> +HERE + + $plist = Mac::PropertyList::parse_plist( $plist ); + isa_ok( $plist, "Mac::PropertyList::string", "Make object from plist string" ); + }; + +subtest create => sub { + Mac::PropertyList->import( 'create_from_string' ); + ok( defined &create_from_string ); + + my $plist = create_from_string( 'Roscoe' ); + + like $plist, qr|<string>Roscoe</string>|, 'Has the string node'; + }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mac-PropertyList-1.413/t/test_manifest new/Mac-PropertyList-1.501/t/test_manifest --- old/Mac-PropertyList-1.413/t/test_manifest 2018-03-22 19:51:21.000000000 +0100 +++ new/Mac-PropertyList-1.501/t/test_manifest 2020-09-30 06:52:18.000000000 +0200 @@ -4,6 +4,7 @@ import.t scalar.t container.t +string.t array.t dict.t get_filehandle.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mac-PropertyList-1.413/t/write_binary.t new/Mac-PropertyList-1.501/t/write_binary.t --- old/Mac-PropertyList-1.413/t/write_binary.t 2018-03-22 19:51:21.000000000 +0100 +++ new/Mac-PropertyList-1.501/t/write_binary.t 2020-09-30 06:52:18.000000000 +0200 @@ -4,10 +4,11 @@ use Data::Dumper; $Data::Dumper::Useqq = 1; +use Math::BigInt; our($val, $expect); -use Test::More tests => 38; +use Test::More tests => 42; BEGIN { my $class = 'Mac::PropertyList::WriteBinary'; @@ -81,6 +82,11 @@ &testrep( array => [], "\xA0" ); &testrep( dict => {}, "\xD0" ); +&testrep( uid => '1', "\x80\x01" ); +&testrep( uid => '2a', "\x80\x2a" ); +&testrep( uid => '04d2', "\x81\x04\xd2" ); +&testrep( uid => '74cbb1', "\x82\x74\xcb\xb1" ); + # The null object is part of the specification but rarely if ever used; # Apple's CFBinaryPList implementation of it appears to never have # been finished anyway.