NAME
Mac::PropertyList::SAX - work with Mac plists at a low level (with real XML parsers)
SYNOPSIS
DESCRIPTION
Mac::PropertyList is useful, but very slow on large files because it does the parsing by itself, intead of handing off the actual XML parsing to a dedicated parser. This module uses XML::SAX::ParserFactory to select a parser capable of doing the heavy lifting, reducing parsing time on large files by up to 97%. This is especially useful for iTunes library plists which may be megabytes in size and contain thousands of entries in dozens of dictionaries.
This module does not, however, replace Mac::PropertyList; in fact, it depends on it for several package definitions and the plist creation routines.
Be aware that performance will depend largely on the parser that XML::SAX::ParserFactory selects for you; if you have not installed XML::SAX::Expat or another fast parser, the default XML::SAX::PurePerl parser will be used; this will probably give worse performance than Mac::PropertyList, so ensure that a fast parser is being used before you complain to me about performance :-). See XML::SAX::ParserFactory for information on how to set which parser is used.
VERSION
Version 0.07
FUNCTIONS
- parse_plist_file
- parse_plist_fh
- parse_plist
- _parse
-
Parsing method called by parse_plist_* (internal use only)
- create_from_ref( HASH_REF | ARRAY_REF )
-
Create a plist dictionary from an array or hash reference.
The values of the hash can be simple scalars or references. References are handled recursively. Reference trees containing Mac::PropertyList objects will be handled correctly (use case: easily combining parsed plists with "regular" Perl data). All scalars are treated as strings (use Mac::PropertyList objects to represent integers or other types of scalars).
Returns a string representing the hash in the plist format.
- create_from_hash( HASH_REF )
-
Provided for backward compatibility with Mac::PropertyList: merely an alias to create_from_ref.
- create_from_array( ARRAY_REF )
-
Provided for backward compatibility with Mac::PropertyList: merely an alias to create_from_ref.
BUGS / TODO
Behavior is not exactly the same as Mac::PropertyList's; specifically, in the case of special characters, such as accented characters and ampersands. Ampersands encoded (for example, as '&') in the original property list will be decoded by the XML parser in this module; Mac::PropertyList leaves them as-is. Also, accented/special characters are converted into '\x{ff}' sequences by the XML parser in this module, but are preserved in their original encoding by Mac::PropertyList. The differences may be evident when creating a plist file from a parsed data structure, but this has not yet been tested.
Please report any bugs or feature requests to bug-mac-propertylist-sax at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Mac-PropertyList-SAX. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Mac::PropertyList::SAX
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Mac-PropertyList-SAX
Search CPAN
AUTHOR
Darren M. Kulp, <darren at kulp.ch>
THANKS
brian d foy, who created the Mac::PropertyList module whose tests were appropriated for this module.
SEE ALSO
Mac::PropertyList, the inspiration for this module.
COPYRIGHT AND LICENSE
Copyright (C) 2007 by Darren Kulp
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.4 or, at your option, any later version of Perl 5 you may have available.