-
-
18 Nov 2009 04:40:48 UTC
- Distribution: Mac-Tie-PList
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (0)
- Testers (1 / 0 / 46)
- Kwalitee
Bus factor: 0- 87.50% Coverage
- License: unknown
- Activity
24 month- Tools
- Download (4.47KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Carp
- Foundation
- Tie::Array
- Tie::Hash
- Tie::Scalar
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
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.
Module Install Instructions
To install Mac::Tie::PList, copy and paste the appropriate command in to your terminal.
cpanm Mac::Tie::PList
perl -MCPAN -e shell install Mac::Tie::PList
For more information on module installation, please visit the detailed CPAN module installation guide.