Data-Plist
view release on metacpan or search on metacpan
lib/Data/Plist.pm view on Meta::CPAN
return $data unless ref $data;
if ( ref $data eq "HASH" ) {
my $hash = { %{$data} };
my $class = delete $hash->{'$class'};
$hash->{$_} = $self->reify( $hash->{$_} ) for keys %{$hash};
if ( $class
and ref $class
and ref $class eq "HASH"
and $class->{'$classname'} )
{
my $classname = "Data::Plist::Foundation::" . $class->{'$classname'};
if ( not $classname->require ) {
warn "Can't require $classname: $@\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;
}
}
return $hash;
} elsif ( ref $data eq "ARRAY" ) {
return [ map $self->reify( $_ ), @{$data} ];
} else {
return $data;
}
}
sub _raw_object {
my $self = shift;
return unless $self->is_archive;
return $self->unref( $self->raw_data->[1]{'$top'}[1]{root} );
}
=head2 object
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<Data::Plist::Foundation::NSOjbect>. Otherwise, returns undef.
=cut
sub object {
my $self = shift;
require Data::Plist::Foundation::NSObject;
return unless $self->is_archive;
return $self->reify( $self->collapse( $self->_raw_object ) );
}
=head1 DEPENDENCIES
L<Class::ISA>, L<DateTime>, L<Digest::MD5>, L<Math::BigInt>,
L<MIME::Base64>, L<Scalar::Util>, L<Storable>, L<UNIVERSAL::isa>,
L<XML::Writer>
=head1 BUGS AND LIMITATIONS
No XML reader is included at current.
Please report any bugs or feature requests to
C<bug-Data-Plist@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>.
=head1 AUTHORS
Alex Vandiver and Jacky Chang.
Based on plutil.pl, written by Pete Wilson <wilsonpm@gamewood.net>
=head1 LICENSE
This module is free software; you can redistribute it and/or modify it
under the same terms as Perl itself. See L<perlartistic>.
=cut
1;
( run in 1.819 second using v1.01-cache-2.11-cpan-39bf76dae61 )