NAME
Mac::Tie::PList - Parse Apple NSDictionary objects (e.g. Preference Lists)
SYNOPSIS
use Mac::Tie::PList;
my $plist = Mac::Tie::PList->new_from_file("/Library/Preferences/.GlobalPreferences.plist");
while ((my $key,$val) = each %$plist) {
print "$key => $val\n";
}
DESCRIPTION
This module allows you to parse NSDictionary objects, as used in PList files, as tied perl objects. It uses the Foundation perl/objective-c bridge and so both xml1 and binary1 formats are currently supported.
The objects are mapped as follows:
NSNumber NSBoolean NSString => perl tied scalar
NSArray => perl tied array
NSDictionary => perl tied hash
NSDate => perl tied string - returns seconds since 1970
NSData => *WARNING* The returned sting format is not decided yet
NOTE: Currently the module only provided read access to the data. Write access is planned in the future.
- my $hash_ref = Mac::Tie::PList->new($data)
-
Parses data and creates a new tied hash based on the data provided as a string.
- my $hash_ref = Mac::Tie::PList->new_from_file($filename)
-
Parses data and creates a new tied hash based on the contents of a file.
SEE ALSO
This module is based on code from the following O'Reilly article:
http://www.macdevcenter.com/pub/a/mac/2005/07/29/plist.html
The Objective C Bridge is descibed at:
http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/PerlObjCBridge.3pm.html
Further details of NSDictionary's is available here:
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_cla
ssic/Classes/NSDictionary.html
AUTHOR
Gavin Brock, <gbrock@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2006 by Gavin Brock
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.0 or, at your option, any later version of Perl 5 you may have available.