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.

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.


This module is based on code from the following O'Reilly article:

The Objective C Bridge is descibed at:

Further details of NSDictionary's is available here:


Gavin Brock, <>


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.