MacOSX::File::Catalog - Get (HFS) Catalog Information for that file
use MacOSX::File::Catalog; $catalog = MacOSX::File::Catalog->get($path); $catalog->type('TEXT'); $catalog->creator('ttxt'); $catalog->flags(-invisible => 1); $catalog->set;
This module allows you to get all gettable attributes of the file or directory specified and set all settable attributes thereof. This module is a superset of MacOSX::File::Info. You can also think this module as stat() for HFS.
Subs: getcatalog(), setcatalog()
Constructs MacOSX::File::Catalog from which you can manipulate file attributes. On failure, it returns undef and $MacOSX::File::OSErr is set.
Sets file attributes of file $path. If $path is omitted the file you used to construct $catalog is used. On success, it returns 1. On failure, it returns 0 and $MacOSX::File::OSErr is set.
Remember any changes to $catalog will not be commited until you call these functions.
ex) setcatalog(getcatalog("foo"), "bar"); #Copies file attributes from foo to bar
returns a pretty-printed string that contains the value of every (gettable) member of FSCatalogInfo structure.
ex) print $catalog->dump;
The file lock status is stored in $catalog->nodeFlags but this field is supposed to be read-only. Use the following methods instead
$catalog->locked $catalog->lock $catalog->unlock
The following methods returns the value of each field;
$catalog->ref Used Internally to store FSRef $catalog->nodeFlags see lock() method $catalog->volume vRefnum there of. Corresponds to st_dev $catalog->parentDirID dirID thereof equiv. to lstat(dirname($path))->ino; $catalog->nodeID nodeID thereof equiv. to lstat($path)->ino; $catalog->sharingFlags $catalog->userPrivileges $catalog->valence
The following methods returns the value of each field without argument. With argument, it sets the value within.
Content Creation Date. equiv. to stat($path)->ctime
Content Modification Date. equiv. to stat($path)->mtime
Attribute Modification Date. Unlike Unix, this value is stored as file attribute. On Unix, mtime of the containing directory would be changed.
Content Access date. equiv. to stat($path)->atime
Backup date. This field is hardly ever used.
Text Encoding Hint
Note that dates in this module is stored as double while catalog stores as UTCDateTime, which is a 64bit fixed floating point. 48bits are for integral part and 16bits are for fractional part. The conversion is done automagically but it won't hurt you to know.
The following methods returns the value of each field as list context without argument. With argument, it sets the value within. when fewer arguments are fed, only first arguments are set with the remaining fields untouched.
eg) $catalog->finderInfo('TEXT', 'ttxt') # changes type and creator with flags and others unchanged
returns 4-element list whose values are UID, GID, MODE there of.
SEE http://developer.apple.com/technotes/tn/tn1150.html#HFSPlusPermissions for the use of this field.
returns 5-element list whose values are type, creator, flags, location and folder information. Only first 3 would be relevant for you. Note this module contains no ->flags method, unlike MacOSX::File::Info module.
returns 5-element list whose values are iconID, xflags, comment and putaway values. I confess I know nothing about this field; I just faithfully coded accordingly to Carbon document. Leave it as it is unless you know what you are doing.
Dan Kogai <firstname.lastname@example.org>
Inside Carbon: File Manager http://developer.apple.com/techpubs/macosx/Carbon/Files/FileManager/File_Manager/index.html
Copyright 2002 Dan Kogai <email@example.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.