| Article: |
Using Perl to Manage Plist Files | |
| Subject: | Alternative solution | |
| Date: | 2005-08-01 08:03:08 | |
| From: | leeg | |
| Just use brian d foy's Mac::PropertyList :-) It just works with XML plist files - I tried writing a version to deal with NeXT-style structish plists but it was only a bit successful. | ||
Showing messages 1 through 2 of 2.
-
Alternative solution
2005-08-01 20:13:28 jamesreynolds [View]
-
Alternative solution
2005-08-02 07:17:18 leeg [View]
For nested values, I just noted that the NeXT-style plist format is almost exactly identical to the definition of an anonymous hash, and tried to massage it until it was exactly identical ;-). Then you get infinitely nested hashes/arrays. I'm sure it's possible, but my regexp skills were not up to scratch. I agree that you can use the Foundation-based solution in the wider context of CamelBones, but then that isn't portable (e.g. if your plists are stored on a FreeBSD NFS server, you may want to run your perl on FreeBSD not Darwin/OS X). There may be some CFLite glue for Perl which could help there, but Mac::PropertyList would definitely work.



Nested values: Arrays in arrays in hashes in arrays, etc.
Cocoa: If using this code proves easy enough, perhaps you'd like to use Foundation to do other things.
Article 2 will go into much more Plist detail. It will be out soon.