home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 May
/
Chip_2000-05_cd1.bin
/
zkuste
/
Perl
/
ActivePerl-5.6.0.613.msi
/
䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥
/
_00a26798af763ad1c8f4125b951183d4
< prev
next >
Wrap
Text File
|
2000-03-23
|
7KB
|
183 lines
<HTML>
<HEAD>
<TITLE>File::Spec::Mac - File::Spec for MacOS</TITLE>
<LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
<LINK REV="made" HREF="mailto:">
</HEAD>
<BODY>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
<STRONG><P CLASS=block> File::Spec::Mac - File::Spec for MacOS</P></STRONG>
</TD></TR>
</TABLE>
<A NAME="__index__"></A>
<!-- INDEX BEGIN -->
<UL>
<LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
<LI><A HREF="#synopsis">SYNOPSIS</A></LI>
<LI><A HREF="#description">DESCRIPTION</A></LI>
<LI><A HREF="#methods">METHODS</A></LI>
<LI><A HREF="#see also">SEE ALSO</A></LI>
</UL>
<!-- INDEX END -->
<HR>
<P>
<H1><A NAME="name">NAME</A></H1>
<P>File::Spec::Mac - File::Spec for MacOS</P>
<P>
<HR>
<H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
<UL>
<LI>Linux</LI>
<LI>Solaris</LI>
<LI>Windows</LI>
</UL>
<HR>
<H1><A NAME="synopsis">SYNOPSIS</A></H1>
<PRE>
require File::Spec::Mac; # Done internally by File::Spec if needed</PRE>
<P>
<HR>
<H1><A NAME="description">DESCRIPTION</A></H1>
<P>Methods for manipulating file specifications.</P>
<P>
<HR>
<H1><A NAME="methods">METHODS</A></H1>
<DL>
<DT><STRONG><A NAME="item_canonpath">canonpath</A></STRONG><BR>
<DD>
On MacOS, there's nothing to be done. Returns what it's given.
<P></P>
<DT><STRONG><A NAME="item_catdir">catdir</A></STRONG><BR>
<DD>
Concatenate two or more directory names to form a complete path ending with
a directory. Put a trailing : on the end of the complete path if there
isn't one, because that's what's done in MacPerl's environment.
<P>The fundamental requirement of this routine is that</P>
<PRE>
File::Spec->catdir(split(":",$path)) eq $path</PRE>
<P>But because of the nature of Macintosh paths, some additional
possibilities are allowed to make using this routine give reasonable results
for some common situations. Here are the rules that are used. Each
argument has its trailing ``:'' removed. Each argument, except the first,
has its leading ``:'' removed. They are then joined together by a ``:''.</P>
<P>So</P>
<PRE>
File::Spec->catdir("a","b") = "a:b:"
File::Spec->catdir("a:",":b") = "a:b:"
File::Spec->catdir("a:","b") = "a:b:"
File::Spec->catdir("a",":b") = "a:b"
File::Spec->catdir("a","","b") = "a::b"</PRE>
<P>etc.</P>
<P>To get a relative path (one beginning with :), begin the first argument with :
or put a ``'' as the first argument.</P>
<P>If you don't want to worry about these rules, never allow a ``:'' on the ends
of any of the arguments except at the beginning of the first.</P>
<P>Under MacPerl, there is an additional ambiguity. Does the user intend that</P>
<PRE>
File::Spec->catfile("LWP","Protocol","http.pm")</PRE>
<P>be relative or absolute? There's no way of telling except by checking for the
existence of LWP: or :LWP, and even there he may mean a dismounted volume or
a relative path in a different directory (like in @INC). So those checks
aren't done here. This routine will treat this as absolute.</P>
<P></P>
<DT><STRONG><A NAME="item_catfile">catfile</A></STRONG><BR>
<DD>
Concatenate one or more directory names and a filename to form a
complete path ending with a filename. Since this uses catdir, the
same caveats apply. Note that the leading : is removed from the filename,
so that
<PRE>
File::Spec->catfile($ENV{HOME},"file");</PRE>
<P>and</P>
<PRE>
File::Spec->catfile($ENV{HOME},":file");</PRE>
<P>give the same answer, as one might expect.</P>
<P></P>
<DT><STRONG><A NAME="item_curdir">curdir</A></STRONG><BR>
<DD>
Returns a string representing the current directory.
<P></P>
<DT><STRONG><A NAME="item_devnull">devnull</A></STRONG><BR>
<DD>
Returns a string representing the null device.
<P></P>
<DT><STRONG><A NAME="item_rootdir">rootdir</A></STRONG><BR>
<DD>
Returns a string representing the root directory. Under MacPerl,
returns the name of the startup volume, since that's the closest in
concept, although other volumes aren't rooted there.
<P></P>
<DT><STRONG><A NAME="item_tmpdir">tmpdir</A></STRONG><BR>
<DD>
Returns a string representation of the first existing directory
from the following list or '' if none exist:
<PRE>
$ENV{TMPDIR}</PRE>
<P></P>
<DT><STRONG><A NAME="item_updir">updir</A></STRONG><BR>
<DD>
Returns a string representing the parent directory.
<P></P>
<DT><STRONG><A NAME="item_file_name_is_absolute">file_name_is_absolute</A></STRONG><BR>
<DD>
Takes as argument a path and returns true, if it is an absolute path. In
the case where a name can be either relative or absolute (for example, a
folder named ``HD'' in the current working directory on a drive named ``HD''),
relative wins. Use ``:'' in the appropriate place in the path if you want to
distinguish unambiguously.
<P></P>
<DT><STRONG><A NAME="item_path">path</A></STRONG><BR>
<DD>
Returns the null list for the MacPerl application, since the concept is
usually meaningless under MacOS. But if you're using the MacPerl tool under
MPW, it gives back $ENV{Commands} suitably split, as is done in
:lib:ExtUtils:MM_Mac.pm.
<P></P>
<DT><STRONG><A NAME="item_splitpath">splitpath</A></STRONG><BR>
<DD>
<DT><STRONG><A NAME="item_splitdir">splitdir</A></STRONG><BR>
<DD>
<DT><STRONG><A NAME="item_catpath">catpath</A></STRONG><BR>
<DD>
<DT><STRONG><A NAME="item_abs2rel">abs2rel</A></STRONG><BR>
<DD>
<DT><STRONG><A NAME="item_rel2abs">rel2abs</A></STRONG><BR>
<DD>
Converts a relative path to an absolute path.
<PRE>
$abs_path = File::Spec->rel2abs( $destination ) ;
$abs_path = File::Spec->rel2abs( $destination, $base ) ;</PRE>
<P>If $base is not present or '', then <EM>cwd()</EM> is used. If $base is relative,
then it is converted to absolute form using <A HREF="#rel2abs()">rel2abs()</A>. This means that it
is taken to be relative to <EM>cwd()</EM>.</P>
<P>On systems with the concept of a volume, this assumes that both paths
are on the $base volume, and ignores the $destination volume.</P>
<P>On systems that have a grammar that indicates filenames, this ignores the
$base filename as well. Otherwise all path components are assumed to be
directories.</P>
<P>If $path is absolute, it is cleaned up and returned using <A HREF="#canonpath()">canonpath()</A>.</P>
<P>Based on code written by Shigio Yamaguchi.</P>
<P>No checks against the filesystem are made.</P>
<P></P></DL>
<P>
<HR>
<H1><A NAME="see also">SEE ALSO</A></H1>
<P><A HREF="../../../lib/File/Spec.html">the File::Spec manpage</A></P>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
<STRONG><P CLASS=block> File::Spec::Mac - File::Spec for MacOS</P></STRONG>
</TD></TR>
</TABLE>
</BODY>
</HTML>