Mac::Tie::PList - Parse Apple NSDictionary objects (e.g. Preference Lists)
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"; }
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.
Parses data and creates a new tied hash based on the data provided as a string.
Parses data and creates a new tied hash based on the contents of a file.
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
Gavin Brock, <gbrock@cpan.org>
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.
To install Mac::Tie::PList, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mac::Tie::PList
CPAN shell
perl -MCPAN -e shell install Mac::Tie::PList
For more information on module installation, please visit the detailed CPAN module installation guide.