X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FFile%2FSpec.pm;h=28379abf7649c80433681779b40cb7314446b269;hb=1158ce344e6265a869b839cb74dfea1138fd2130;hp=a2c4b974c18e6dcd3cd83bb624df6233a181b62d;hpb=21f4e7e5deb9dcacb7ae8fa00f7857b644748023;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/File/Spec.pm b/lib/File/Spec.pm index a2c4b97..28379ab 100644 --- a/lib/File/Spec.pm +++ b/lib/File/Spec.pm @@ -3,7 +3,7 @@ package File::Spec; use strict; use vars qw(@ISA $VERSION); -$VERSION = '3.01'; +$VERSION = '3.24'; $VERSION = eval $VERSION; my %module = (MacOS => 'Mac', @@ -12,7 +12,8 @@ my %module = (MacOS => 'Mac', VMS => 'VMS', epoc => 'Epoc', NetWare => 'Win32', # Yes, File::Spec::Win32 works on NetWare. - dos => 'OS2', # Yes, File::Spec::OS2 works on DJGPP. + symbian => 'Win32', # Yes, File::Spec::Win32 works on symbian. + dos => 'OS2', # Yes, File::Spec::OS2 works on DJGPP. cygwin => 'Cygwin'); @@ -82,13 +83,22 @@ forms of these methods. =over 2 =item canonpath +X No physical check on the filesystem, but a logical cleanup of a path. $cpath = File::Spec->canonpath( $path ) ; +Note that this does *not* collapse F sections into F. This +is by design. If F on your system is a symlink to F, +then F is actually F, not F as a naive +F<../>-removal would give you. If you want to do this kind of +processing, you probably want C's C function to +actually traverse the filesystem cleaning up paths like this. + =item catdir +X Concatenate two or more directory names to form a complete path ending with a directory. But remove the trailing slash from the resulting @@ -99,6 +109,7 @@ trailing slash :-) $path = File::Spec->catdir( @directories ); =item catfile +X Concatenate one or more directory names and a filename to form a complete path ending with a filename @@ -106,24 +117,28 @@ complete path ending with a filename $path = File::Spec->catfile( @directories, $filename ); =item curdir +X Returns a string representation of the current directory. $curdir = File::Spec->curdir(); =item devnull +X Returns a string representation of the null device. $devnull = File::Spec->devnull(); =item rootdir +X Returns a string representation of the root directory. $rootdir = File::Spec->rootdir(); =item tmpdir +X Returns a string representation of the first writable directory from a list of possible temporary directories. Returns the current directory @@ -134,6 +149,7 @@ checked depends on the platform; e.g. File::Spec::Unix checks C<$ENV{TMPDIR}> $tmpdir = File::Spec->tmpdir(); =item updir +X Returns a string representation of the parent directory. @@ -164,6 +180,7 @@ Mac OS (Classic). It does consult the working environment for VMS (see L). =item path +X Takes no argument. Returns the environment variable C (or the local platform's equivalent) as a list. @@ -171,10 +188,12 @@ platform's equivalent) as a list. @PATH = File::Spec->path(); =item join +X join is the same as catfile. =item splitpath +X X Splits a path in to volume, directory, and filename portions. On systems with no concept of volume, returns '' for volume. @@ -193,6 +212,7 @@ The results can be passed to L to get back a path equivalent to (usually identical to) the original path. =item splitdir +X X The opposite of L. @@ -215,6 +235,7 @@ inserted if need be. On other OSes, C<$volume> is significant. $full_path = File::Spec->catpath( $volume, $directory, $file ); =item abs2rel +X X X Takes a destination path and an optional base path returns a relative path from the base path to the destination path: @@ -222,10 +243,10 @@ from the base path to the destination path: $rel_path = File::Spec->abs2rel( $path ) ; $rel_path = File::Spec->abs2rel( $path, $base ) ; -If C<$base> is not present or '', then L is used. If C<$base> is +If C<$base> is not present or '', then L is used. If C<$base> is relative, then it is converted to absolute form using L. This means that it is taken to be relative to -L. +L. On systems with the concept of volume, if C<$path> and C<$base> appear to be on two different volumes, we will not attempt to resolve the two @@ -238,7 +259,7 @@ C<$base> filename as well. Otherwise all path components are assumed to be directories. If C<$path> is relative, it is converted to absolute form using L. -This means that it is taken to be relative to L. +This means that it is taken to be relative to L. No checks against the filesystem are made. On VMS, there is interaction with the working environment, as logicals and @@ -247,15 +268,16 @@ macros are expanded. Based on code written by Shigio Yamaguchi. =item rel2abs() +X X X Converts a relative path to an absolute path. $abs_path = File::Spec->rel2abs( $path ) ; $abs_path = File::Spec->rel2abs( $path, $base ) ; -If C<$base> is not present or '', then L is used. If C<$base> is relative, +If C<$base> is not present or '', then L is used. If C<$base> is relative, then it is converted to absolute form using L. This means that it -is taken to be relative to L. +is taken to be relative to L. On systems with the concept of volume, if C<$path> and C<$base> appear to be on two different volumes, we will not attempt to resolve the two @@ -304,4 +326,11 @@ abs2rel() and rel2abs() written by Shigio Yamaguchi C<< >>, modified by Barrie Slaymaker C<< >>. splitpath(), splitdir(), catpath() and catdir() by Barrie Slaymaker. +=head1 COPYRIGHT + +Copyright (c) 2004 by the Perl 5 Porters. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + =cut