MacOSX::File::Spec - Access FFSpec structure


MacOSX-File documentation Contained in the MacOSX-File distribution.

Index


Code Index:

NAME

Top

MacOSX::File::Spec - Access FFSpec structure

SYNOPSIS

Top

  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;

DESCRIPTION

Top

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.

$spec->vRefNum

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

$spec->parID

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.

$spec->name

Returns file name without path component.

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

Returns vRefNum, parID, and name all at once.

$spec->path

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.

EXPORT

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

AUTHOR

Top

Dan Kogai <dankogai@dan.co.jp>

SEE ALSO

Top

MacOSX::File

 L<File::Spec>

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

COPYRIGHT

Top


MacOSX-File documentation Contained in the MacOSX-File distribution.

package MacOSX::File::Spec;

use 5.006;
use strict;
use warnings;
use Carp;

our $RCSID = q$Id: Spec.pm,v 0.70 2005/08/09 15:47:00 dankogai Exp $;
our $VERSION = do { my @r = (q$Revision: 0.70 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
our $DEBUG;

require Exporter;
require DynaLoader;
use AutoLoader;

our @ISA = qw(Exporter DynaLoader);

# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.

# This allows declaration	use MacOSX::File::Spec ':all';
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory.
our %EXPORT_TAGS = ( 'all' => [ qw(
	
) ] );

our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );

our @EXPORT = qw(
		 path2spec
		 );

bootstrap MacOSX::File::Spec $VERSION;
use MacOSX::File;

sub path2spec { MacOSX::File::Spec->new(@_) }

# Preloaded methods go here.

# Autoload methods go after =cut, and are processed by the autosplit program.

1;
__END__