<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package File::Spec;

use strict;

our $VERSION = '3.88';
$VERSION =~ tr/_//d;

my %module = (
	      MSWin32 =&gt; 'Win32',
	      os2     =&gt; 'OS2',
	      VMS     =&gt; 'VMS',
	      NetWare =&gt; 'Win32', # Yes, File::Spec::Win32 works on NetWare.
	      symbian =&gt; 'Win32', # Yes, File::Spec::Win32 works on symbian.
	      dos     =&gt; 'OS2',   # Yes, File::Spec::OS2 works on DJGPP.
	      cygwin  =&gt; 'Cygwin',
	      amigaos =&gt; 'AmigaOS');


my $module = $module{$^O} || 'Unix';

require "File/Spec/$module.pm";
our @ISA = ("File::Spec::$module");

1;

__END__

=head1 NAME

File::Spec - portably perform operations on file names

=head1 SYNOPSIS

	use File::Spec;

	my $x = File::Spec-&gt;catfile('a', 'b', 'c');

which returns 'a/b/c' under Unix. Or:

	use File::Spec::Functions;

	my $x = catfile('a', 'b', 'c');

=head1 DESCRIPTION

This module is designed to support operations commonly performed on file
specifications (usually called "file names", but not to be confused with the
contents of a file, or Perl's file handles), such as concatenating several
directory and file names into a single path, or determining whether a path
is rooted. It is based on code directly taken from MakeMaker 5.17, code
written by Andreas KE&lt;ouml&gt;nig, Andy Dougherty, Charles Bailey, Ilya
Zakharevich, Paul Schinder, and others.

Since these functions are different for most operating systems, each set of
OS specific routines is available in a separate module, including:

	File::Spec::Unix
	File::Spec::Mac
	File::Spec::OS2
	File::Spec::Win32
	File::Spec::VMS

The module appropriate for the current OS is automatically loaded by
File::Spec. Since some modules (like VMS) make use of facilities available
only under that OS, it may not be possible to load all modules under all
operating systems.

Since File::Spec is object oriented, subroutines should not be called directly,
as in:

	File::Spec::catfile('a','b');

but rather as class methods:

	File::Spec-&gt;catfile('a','b');

For simple uses, L&lt;File::Spec::Functions&gt; provides convenient functional
forms of these methods.

=head1 METHODS

=over 2

=item canonpath
X&lt;canonpath&gt;

No physical check on the filesystem, but a logical cleanup of a
path.

    $cpath = File::Spec-&gt;canonpath( $path ) ;

Note that this does *not* collapse F&lt;x/../y&gt; sections into F&lt;y&gt;.  This
is by design.  If F&lt;/foo&gt; on your system is a symlink to F&lt;/bar/baz&gt;,
then F&lt;/foo/../quux&gt; is actually F&lt;/bar/quux&gt;, not F&lt;/quux&gt; as a naive
F&lt;../&gt;-removal would give you.  If you want to do this kind of
processing, you probably want C&lt;Cwd&gt;'s C&lt;realpath()&gt; function to
actually traverse the filesystem cleaning up paths like this.

=item catdir
X&lt;catdir&gt;

Concatenate two or more directory names to form a complete path ending
with a directory. But remove the trailing slash from the resulting
string, because it doesn't look good, isn't necessary and confuses
OS/2. Of course, if this is the root directory, don't cut off the
trailing slash :-)

    $path = File::Spec-&gt;catdir( @directories );

=item catfile
X&lt;catfile&gt;

Concatenate one or more directory names and a filename to form a
complete path ending with a filename

    $path = File::Spec-&gt;catfile( @directories, $filename );

=item curdir
X&lt;curdir&gt;

Returns a string representation of the current directory.

    $curdir = File::Spec-&gt;curdir();

=item devnull
X&lt;devnull&gt;

Returns a string representation of the null device.

    $devnull = File::Spec-&gt;devnull();

=item rootdir
X&lt;rootdir&gt;

Returns a string representation of the root directory.

    $rootdir = File::Spec-&gt;rootdir();

=item tmpdir
X&lt;tmpdir&gt;

Returns a string representation of the first writable directory from a
list of possible temporary directories.  Returns the current directory
if no writable temporary directories are found.  The list of directories
checked depends on the platform; e.g. File::Spec::Unix checks C&lt;$ENV{TMPDIR}&gt;
(unless taint is on) and F&lt;/tmp&gt;.

    $tmpdir = File::Spec-&gt;tmpdir();

=item updir
X&lt;updir&gt;

Returns a string representation of the parent directory.

    $updir = File::Spec-&gt;updir();

=item no_upwards

Given a list of files in a directory (such as from C&lt;readdir()&gt;),
strip out C&lt;'.'&gt; and C&lt;'..'&gt;.

B&lt;SECURITY NOTE:&gt; This does NOT filter paths containing C&lt;'..'&gt;, like
C&lt;'../../../../etc/passwd'&gt;, only literal matches to C&lt;'.'&gt; and C&lt;'..'&gt;.

    @paths = File::Spec-&gt;no_upwards( readdir $dirhandle );

=item case_tolerant

Returns a true or false value indicating, respectively, that alphabetic
case is not or is significant when comparing file specifications.
Cygwin and Win32 accept an optional drive argument.

    $is_case_tolerant = File::Spec-&gt;case_tolerant();

=item file_name_is_absolute

Takes as its argument a path, and returns true if it is an absolute path.

    $is_absolute = File::Spec-&gt;file_name_is_absolute( $path );

This does not consult the local filesystem on Unix, Win32, OS/2, or
Mac OS (Classic).  It does consult the working environment for VMS
(see L&lt;File::Spec::VMS/file_name_is_absolute&gt;).

=item path
X&lt;path&gt;

Takes no argument.  Returns the environment variable C&lt;PATH&gt; (or the local
platform's equivalent) as a list.

    @PATH = File::Spec-&gt;path();

=item join
X&lt;join, path&gt;

join is the same as catfile.

=item splitpath
X&lt;splitpath&gt; X&lt;split, path&gt;

Splits a path in to volume, directory, and filename portions. On systems
with no concept of volume, returns '' for volume. 

    ($volume,$directories,$file) =
                       File::Spec-&gt;splitpath( $path );
    ($volume,$directories,$file) =
                       File::Spec-&gt;splitpath( $path, $no_file );

For systems with no syntax differentiating filenames from directories, 
assumes that the last file is a path unless C&lt;$no_file&gt; is true or a
trailing separator or F&lt;/.&gt; or F&lt;/..&gt; is present. On Unix, this means that C&lt;$no_file&gt;
true makes this return ( '', $path, '' ).

The directory portion may or may not be returned with a trailing '/'.

The results can be passed to L&lt;/catpath()&gt; to get back a path equivalent to
(usually identical to) the original path.

=item splitdir
X&lt;splitdir&gt; X&lt;split, dir&gt;

The opposite of L&lt;/catdir&gt;.

    @dirs = File::Spec-&gt;splitdir( $directories );

C&lt;$directories&gt; must be only the directory portion of the path on systems 
that have the concept of a volume or that have path syntax that differentiates
files from directories.

Unlike just splitting the directories on the separator, empty
directory names (C&lt;''&gt;) can be returned, because these are significant
on some OSes.

=item catpath()

Takes volume, directory and file portions and returns an entire path. Under
Unix, C&lt;$volume&gt; is ignored, and directory and file are concatenated.  A '/' is
inserted if need be.  On other OSes, C&lt;$volume&gt; is significant.

    $full_path = File::Spec-&gt;catpath( $volume, $directory, $file );

=item abs2rel
X&lt;abs2rel&gt; X&lt;absolute, path&gt; X&lt;relative, path&gt;

Takes a destination path and an optional base path returns a relative path
from the base path to the destination path:

    $rel_path = File::Spec-&gt;abs2rel( $path ) ;
    $rel_path = File::Spec-&gt;abs2rel( $path, $base ) ;

If C&lt;$base&gt; is not present or '', then L&lt;Cwd::cwd()|Cwd&gt; is used. If C&lt;$base&gt; is
relative, then it is converted to absolute form using
L&lt;/rel2abs()&gt;. This means that it is taken to be relative to
L&lt;Cwd::cwd()|Cwd&gt;.

On systems with the concept of volume, if C&lt;$path&gt; and C&lt;$base&gt; appear to be
on two different volumes, we will not attempt to resolve the two
paths, and we will instead simply return C&lt;$path&gt;.  Note that previous
versions of this module ignored the volume of C&lt;$base&gt;, which resulted in
garbage results part of the time.

On systems that have a grammar that indicates filenames, this ignores the 
C&lt;$base&gt; filename as well. Otherwise all path components are assumed to be
directories.

If C&lt;$path&gt; is relative, it is converted to absolute form using L&lt;/rel2abs()&gt;.
This means that it is taken to be relative to L&lt;Cwd::cwd()|Cwd&gt;.

No checks against the filesystem are made.  On VMS, there is
interaction with the working environment, as logicals and
macros are expanded.

Based on code written by Shigio Yamaguchi.

=item rel2abs()
X&lt;rel2abs&gt; X&lt;absolute, path&gt; X&lt;relative, path&gt;

Converts a relative path to an absolute path. 

    $abs_path = File::Spec-&gt;rel2abs( $path ) ;
    $abs_path = File::Spec-&gt;rel2abs( $path, $base ) ;

If C&lt;$base&gt; is not present or '', then L&lt;Cwd::cwd()|Cwd&gt; is used. If C&lt;$base&gt; is relative,
then it is converted to absolute form using L&lt;/rel2abs()&gt;. This means that it
is taken to be relative to L&lt;Cwd::cwd()|Cwd&gt;.

On systems with the concept of volume, if C&lt;$path&gt; and C&lt;$base&gt; appear to be
on two different volumes, we will not attempt to resolve the two
paths, and we will instead simply return C&lt;$path&gt;.  Note that previous
versions of this module ignored the volume of C&lt;$base&gt;, which resulted in
garbage results part of the time.

On systems that have a grammar that indicates filenames, this ignores the 
C&lt;$base&gt; filename as well. Otherwise all path components are assumed to be
directories.

If C&lt;$path&gt; is absolute, it is cleaned up and returned using L&lt;/canonpath&gt;.

No checks against the filesystem are made.  On VMS, there is
interaction with the working environment, as logicals and
macros are expanded.

Based on code written by Shigio Yamaguchi.

=back

For further information, please see L&lt;File::Spec::Unix&gt;,
L&lt;File::Spec::Mac&gt;, L&lt;File::Spec::OS2&gt;, L&lt;File::Spec::Win32&gt;, or
L&lt;File::Spec::VMS&gt;.

=head1 SEE ALSO

L&lt;File::Spec::Unix&gt;, L&lt;File::Spec::Mac&gt;, L&lt;File::Spec::OS2&gt;,
L&lt;File::Spec::Win32&gt;, L&lt;File::Spec::VMS&gt;, L&lt;File::Spec::Functions&gt;,
L&lt;ExtUtils::MakeMaker&gt;

=head1 AUTHOR

Maintained by perl5-porters &lt;F&lt;perl5-porters@perl.org&gt;&gt;.

The vast majority of the code was written by
Kenneth Albanowski C&lt;&lt; &lt;kjahds@kjahds.com&gt; &gt;&gt;,
Andy Dougherty C&lt;&lt; &lt;doughera@lafayette.edu&gt; &gt;&gt;,
Andreas KE&lt;ouml&gt;nig C&lt;&lt; &lt;A.Koenig@franz.ww.TU-Berlin.DE&gt; &gt;&gt;,
Tim Bunce C&lt;&lt; &lt;Tim.Bunce@ig.co.uk&gt; &gt;&gt;.
VMS support by Charles Bailey C&lt;&lt; &lt;bailey@newman.upenn.edu&gt; &gt;&gt;.
OS/2 support by Ilya Zakharevich C&lt;&lt; &lt;ilya@math.ohio-state.edu&gt; &gt;&gt;.
Mac support by Paul Schinder C&lt;&lt; &lt;schinder@pobox.com&gt; &gt;&gt;, and
Thomas Wegner C&lt;&lt; &lt;wegner_thomas@yahoo.com&gt; &gt;&gt;.
abs2rel() and rel2abs() written by Shigio Yamaguchi C&lt;&lt; &lt;shigio@tamacom.com&gt; &gt;&gt;,
modified by Barrie Slaymaker C&lt;&lt; &lt;barries@slaysys.com&gt; &gt;&gt;.
splitpath(), splitdir(), catpath() and catdir() by Barrie Slaymaker.

=head1 COPYRIGHT

Copyright (c) 2004-2013 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
</pre></body></html>