View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Dan Kogai > MacOSX-File > MacOSX::File::Catalog



Annotate this POD


New  6
Open  1
View/Report Bugs
Module Version: 0.70   Source  


MacOSX::File::Catalog - Get (HFS) Catalog Information for that file


  use MacOSX::File::Catalog;
  $catalog = MacOSX::File::Catalog->get($path);
  $catalog->flags(-invisible => 1);


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()


$catalog = MacOSX::File::Catalog->get($path);
$catalog = getfileinfo($path);

Constructs MacOSX::File::Catalog from which you can manipulate file attributes. On failure, it returns undef and $MacOSX::File::OSErr is set.

setcatalog($catalog, [$path]);

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.

    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;

file lock

The file lock status is stored in $catalog->nodeFlags but this field is supposed to be read-only. Use the following methods instead


Read-only access methods

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;

Access methods with scalar argument

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.

Access methods with list argument

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

($uid, $gid, $mode, $specialDevice) = $catalog->permissions(...)

returns 4-element list whose values are UID, GID, MODE there of.

SEE for the use of this field.

($type, $creator, $flags, $location, $fdfldr) = $catalog->finderInfo(...)

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.

($iconID, $script, $xflags, $comment, $putaway) = $catalog->extFinderInfo(...)

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 <>



Inside Carbon: File Manager


Copyright 2002 Dan Kogai <>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: