Dan Kogai


MacOSX::File::Spec - Access FFSpec structure


  use MacOSX::File::Spec;
  $spec = MacOSX::File::Spec->new($path);
  # or
  $spec = path2spec($path);
  vRefNum = $spec->vRefNum;
  parID   = $spec->parID;
  name    = $spec->name;
  ($vRefNum, $parID, $name) = $spec->as_array
  path    = $spec->path;


This module allows you to access FSSpec structure, which is used to locate files on MacOS. Though MacOS X allows you to access any files via path like any decent UNIX, you may still have to access files via old-fasioned MacOS way so here is the module.

$spec = MacOSX::File::Spec->new($path); =item $spec = path2spec($path)

Creates MacOSX::File::Spec object from which you can access members within. When any error occurs, undef is returned and $MacOS::File::OSErr is set to nonzero.


Returns Volume Reference Number. Its Unix equivalent would be stat($path)->dev.


Returns Parent ID, or the Directory ID of the directory in which the file resides. Its Unix equivalent would be stat(dirname($path))->ino but as you know, Unix does not allow you to access directly via i-node.


Returns file name without path component.

($vRefNum, $parID, $name) = $spec->as_array

Returns vRefNum, parID, and name all at once.


Returns the absolute path which is reconstructed via FSSpec. Not necessarily equal to $path when you constructed this object. Could be handy when you want an absolute path of a file which path you know only relatively.


path2spec(), which is an alias of MacOSX::File::Spec->new();


Dan Kogai <dankogai@dan.co.jp>




Inside Carbon: File Manager http://developer.apple.com/techpubs/macosx/Carbon/Files/FileManager/filemanager.html


Copyright 2002 Dan Kogai <dankogai@dan.co.jp>

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