=encoding euc-jp =head1 NAME =begin original File::Spec - portably perform operations on file names =end original File::Spec - ファイル名に関して移植性のある操作を行う =head1 SYNOPSIS use File::Spec; $x=File::Spec->catfile('a', 'b', 'c'); =begin original which returns 'a/b/c' under Unix. Or: =end original これは Unix では 'a/b/c' を返します。 あるいは: use File::Spec::Functions; $x = catfile('a', 'b', 'c'); =head1 DESCRIPTION =begin original 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 KEnig, Andy Dougherty, Charles Bailey, Ilya Zakharevich, Paul Schinder, and others. =end original このモジュールは、ファイル指定 (file specifications) (通常「ファイル名」と 呼ばれますが、ファイルの内容やPerl のファイルハンドルと 混同しないようにしてください) に対して、 複数のディレクトリとファイル名の単一のパスへの結合、 パスがルートからかの決定、といった一般的に行われる操作に 対応するために設計されています。 これは Andreas KEnig, Andy Dougherty, Charles Bailey, Ilya Zakharevich, Paul Schinder などによって書かれた MakeMaker 5.17 から 直接コードを取っています。 =begin original Since these functions are different for most operating systems, each set of OS specific routines is available in a separate module, including: =end original これらの関数はほとんどのオペレーティングシステムによって異なるので、 それぞれの OS 固有のルーチンは次のような別々のモジュールで利用可能です: File::Spec::Unix File::Spec::Mac File::Spec::OS2 File::Spec::Win32 File::Spec::VMS =begin original 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. =end original 現在の OS のための適切なモジュールは File::Spec によって自動的に 読み込まれます。 (VMS のような) 一部のモジュールはその OS でのみ利用可能な機能を 使っているので、全てのオペレーティングシステムで全てのモジュールが 読み込まれるわけではありません。 =begin original Since File::Spec is object oriented, subroutines should not be called directly, as in: =end original File::Spec はオブジェクト指向なので、サブルーチンは次のように 直接呼び出されるべきではありません: File::Spec::catfile('a','b'); =begin original but rather as class methods: =end original 次のようにクラスメソッドとして呼び出してください: File::Spec->catfile('a','b'); =begin original For simple uses, L provides convenient functional forms of these methods. =end original 単純な用途のために、L がこれらのメソッドの便利な 関数形式を提供します。 =head1 METHODS (メソッド) =over 2 =item canonpath X =begin original No physical check on the filesystem, but a logical cleanup of a path. =end original ファイルシステムでの物理的なチェックはせずに、パスを論理的に整理します。 $cpath = File::Spec->canonpath( $path ) ; =begin original 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. =end original これは F を F に短縮「しない」ことに注意してください。 これは仕様です。 あなたのシステムでの F が F へのシンボリックリンクの場合、 F は、単純に F<../> を削除した結果となる F ではなく、 実際には F となります。 このような処理をしたい場合は、このようなパスを実際にファイルシステムを たどって整理する C の C を使うべきでしょう。 =item catdir X =begin original 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 :-) =end original 二つ以上のディレクトリ名を、ディレクトリで終わる完全なパスの形に 結合します。 しかし、結果の文字列の末尾のスラッシュは削除されます; 見た目が良くなく、不要であり、OS/2 を混乱させるからです。 もちろん、これがルートディレクトリの場合は、末尾のスラッシュは 削除されません :-) $path = File::Spec->catdir( @directories ); =item catfile X =begin original Concatenate one or more directory names and a filename to form a complete path ending with a filename =end original 一つ以上のディレクトリ名とファイル名を、ファイル名で終わる 完全なパスの形に結合します。 $path = File::Spec->catfile( @directories, $filename ); =item curdir X =begin original Returns a string representation of the current directory. =end original カレントディレクトリの文字列表現を返します。 $curdir = File::Spec->curdir(); =item devnull X =begin original Returns a string representation of the null device. =end original ヌルデバイスの文字列表現を返します。 $devnull = File::Spec->devnull(); =item rootdir X =begin original Returns a string representation of the root directory. =end original ルートディレクトリの文字列表現を返します。 $rootdir = File::Spec->rootdir(); =item tmpdir X =begin original 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<$ENV{TMPDIR}> (unless taint is on) and F. =end original 一時ディレクトリの候補の一覧から最初の書き込み可能ディレクトリの 文字列表現を返します。 もし書き込み可能な一時ディレクトリが見つからなかった場合は カレントディレクトリを返します。 チェックされるディレクトリの一覧はプラットフォームに依存します; 例えば、File::Spec::Unix は C<$ENV{TMPDIR}> (汚染チェックがオンでない場合)と F をチェックします。 $tmpdir = File::Spec->tmpdir(); =item updir X =begin original Returns a string representation of the parent directory. =end original 親ディレクトリの文字列表現を返します。 $updir = File::Spec->updir(); =item no_upwards =begin original Given a list of file names, strip out those that refer to a parent directory. (Does not strip symlinks, only '.', '..', and equivalents.) =end original ファイル名のリストを取って、親ディレクトリを参照しているものを 取り除きます。 (シンボリックリンクは取り除きません; '.', '..' および等価物のみです。) @paths = File::Spec->no_upwards( @paths ); =item case_tolerant =begin original Returns a true or false value indicating, respectively, that alphabetic case is not or is significant when comparing file specifications. =end original ファイル指定を比較するときに、英字の大文字小文字を認識するかどうかを示す 真または偽の値を返します。 $is_case_tolerant = File::Spec->case_tolerant(); =item file_name_is_absolute =begin original Takes as its argument a path, and returns true if it is an absolute path. =end original パスを引数として取り、これが絶対パスの場合に真を返します。 $is_absolute = File::Spec->file_name_is_absolute( $path ); =begin original 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). =end original これは、Unix, Win32, OS/2, Mac OS (Classic) ではローカルのファイルシステムを 参照しません。 VMS の動作環境では参照します (L を 参照してください)。 =item path X =begin original Takes no argument. Returns the environment variable C (or the local platform's equivalent) as a list. =end original 引数を取りません。 C 環境変数 (またはローカルなプラットフォームでの等価物) を リストとして返します。 @PATH = File::Spec->path(); =item join X =begin original join is the same as catfile. =end original join は catfile と同じです。 =item splitpath X X =begin original Splits a path in to volume, directory, and filename portions. On systems with no concept of volume, returns '' for volume. =end original パスをボリューム、ディレクトリ、ファイル名の部分に分割します。 ボリュームの概念がないシステムでは、ボリュームとして '' を返します。 ($volume,$directories,$file) = File::Spec->splitpath( $path ); ($volume,$directories,$file) = File::Spec->splitpath( $path, $no_file ); =begin original For systems with no syntax differentiating filenames from directories, assumes that the last file is a path unless C<$no_file> is true or a trailing separator or F or F is present. On Unix, this means that C<$no_file> true makes this return ( '', $path, '' ). =end original ファイル名とディレクトリに文法上の違いがないシステムでは、 C<$no_file> が真であったり末尾の区切り文字や F or F があったり、 ということがなければ、最後のファイルがパスであると仮定します。 Unix では、C<$no_file> が真の場合、これは ( '', $path, '' ) を 返すということです。 =begin original The directory portion may or may not be returned with a trailing '/'. =end original ディレクトリ部は末尾の '/' があるかもしれませんしないかもしれません。 =begin original The results can be passed to L to get back a path equivalent to (usually identical to) the original path. =end original 結果は、元のパスと等価な (通常は同じ) パスを取り戻すために L に渡せます。 =item splitdir X X =begin original The opposite of L. =end original L の逆です。 @dirs = File::Spec->splitdir( $directories ); =begin original C<$directories> 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. =end original ボリュームの概念があるか、ファイルとディレクトリに違いがあるパス文法の システムの場合、C<$directories> はパスの唯一の ディレクトリ部でなければなりません。 =begin original Unlike just splitting the directories on the separator, empty directory names (C<''>) can be returned, because these are significant on some OSes. =end original 単にディレクトリを区切り文字で分割するのと異なり、空ディレクトリ名 (C<''>) が返されることがあります; 一部の OS ではこれが意味を持つからです。 =item catpath() =begin original Takes volume, directory and file portions and returns an entire path. Under Unix, C<$volume> is ignored, and directory and file are concatenated. A '/' is inserted if need be. On other OSes, C<$volume> is significant. =end original ボリューム、ディレクトリ、ファイル部を取って、パス全体を返します。 Unix では、C<$volume> は無視され、ディレクトリとファイルは結合されます。 必要な場合は '/' が挿入されます。 その他の OS では、C<$volume> は意味を持ちます。 $full_path = File::Spec->catpath( $volume, $directory, $file ); =item abs2rel X X X =begin original Takes a destination path and an optional base path returns a relative path from the base path to the destination path: =end original 目標パスとオプションの基底パスを取って、基底パスから目標パスへの 相対パスを返します: $rel_path = File::Spec->abs2rel( $path ) ; $rel_path = File::Spec->abs2rel( $path, $base ) ; =begin original 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. =end original C<$base> が存在しないか '' の場合、L が使われます。 C<$base> が相対の場合、L を使って絶対形式に変換されます。 つまり、L からの相対パスになります。 =begin original 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 paths, and we will instead simply return C<$path>. Note that previous versions of this module ignored the volume of C<$base>, which resulted in garbage results part of the time. =end original ボリュームの概念があるシステムでは、C<$path> と C<$base> に異なった ボリュームがあるように見える場合、二つのパスを解決しようとせずに、 単に C<$path> を返します。 このモジュールの以前のバージョンでは、C<$base> のボリュームを 無視していたため、一時期壊れた結果を返していました。 =begin original On systems that have a grammar that indicates filenames, this ignores the C<$base> filename as well. Otherwise all path components are assumed to be directories. =end original ファイル名を示す文法がある場合、C<$base> ファイル名も無視されます。 さもなければ全てのパス要素はディレクトリであると仮定されます。 =begin original If C<$path> is relative, it is converted to absolute form using L. This means that it is taken to be relative to L. =end original C<$path> が相対の場合、L を使って絶対形式に変換されます。 つまり、L からの相対パスとなります。 =begin original No checks against the filesystem are made. On VMS, there is interaction with the working environment, as logicals and macros are expanded. =end original ファイルシステムがあるかどうかのチェックは行いません。 VMS では、論理とマクロが拡張されるので、動作環境との相互作用があります。 =begin original Based on code written by Shigio Yamaguchi. =end original Shigio Yamaguchi が書いたコードを基にしています。 =item rel2abs() X X X =begin original Converts a relative path to an absolute path. =end original 相対パスを絶対パスに変換します。 $abs_path = File::Spec->rel2abs( $path ) ; $abs_path = File::Spec->rel2abs( $path, $base ) ; =begin original 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. =end original C<$base> が存在しないか '' の場合、L が使われます。 C<$base> が相対の場合、L を使って絶対形式に変換されます。 つまり、L からの相対パスとなります。 =begin original 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 paths, and we will instead simply return C<$path>. Note that previous versions of this module ignored the volume of C<$base>, which resulted in garbage results part of the time. =end original ボリュームの概念があるシステムでは、C<$path> と C<$base> に異なった ボリュームがあるように見える場合、二つのパスを解決しようとせずに、 単に C<$path> を返します。 このモジュールの以前のバージョンでは、C<$base> のボリュームを 無視していたため、一時期壊れた結果を返していました。 =begin original On systems that have a grammar that indicates filenames, this ignores the C<$base> filename as well. Otherwise all path components are assumed to be directories. =end original ファイル名を示す文法がある場合、C<$base> ファイル名も無視されます。 さもなければ全てのパス要素はディレクトリであると仮定されます。 =begin original If C<$path> is absolute, it is cleaned up and returned using L. =end original C<$path> が絶対パスの場合、L を使って整理したものを返します。 =begin original No checks against the filesystem are made. On VMS, there is interaction with the working environment, as logicals and macros are expanded. =end original ファイルシステムがあるかどうかのチェックは行いません。 VMS では、論理とマクロが拡張されるので、動作環境との相互作用があります。 =begin original Based on code written by Shigio Yamaguchi. =end original Shigio Yamaguchi が書いたコードを基にしています。 =back =begin original For further information, please see L, L, L, L, or L. =end original さらなる情報については、L, L, L, L, L を参照してください。 =head1 SEE ALSO L, L, L, L, L, L, L =head1 AUTHOR =begin original Currently maintained by Ken Williams C<< >>. =end original 現在のところ Ken Williams C<< >> によって 保守されています。 =begin original The vast majority of the code was written by Kenneth Albanowski C<< >>, Andy Dougherty C<< >>, Andreas KEnig C<< >>, Tim Bunce C<< >>. VMS support by Charles Bailey C<< >>. OS/2 support by Ilya Zakharevich C<< >>. Mac support by Paul Schinder C<< >>, and Thomas Wegner C<< >>. abs2rel() and rel2abs() written by Shigio Yamaguchi C<< >>, modified by Barrie Slaymaker C<< >>. splitpath(), splitdir(), catpath() and catdir() by Barrie Slaymaker. =end original 大部分のコードは Kenneth Albanowski C<< >>, Andy Dougherty C<< >>, Andreas KEnig C<< >>, Tim Bunce C<< >> によって書かれました。 VMS 対応は Charles Bailey C<< >> によるものです。 OS/2 対応は Ilya Zakharevich C<< >> による ものです。 Mac 対応は Paul Schinder C<< >> と Thomas Wegner C<< >> によるものです。 abs2rel() と rel2abs() は Shigio Yamaguchi C<< >> によって書かれ、 Barrie Slaymaker C<< >> によって修正されました。 splitpath(), splitdir(), catpath() and catdir() は 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. =begin meta Translate: SHIRAKATA Kentaro Status: completed =end meta =cut