NAME

File::AnySpec - perform operations on foreign (remote) file names

SYNOPSIS

use File::AnySpec

$file                                 = File::FileUtil->fspec2fspec($from_fspec, $to_fspec $fspec_file, [$nofile])
$os_file                              = File::FileUtil->fspec2os($fspec, $file, [$no_file])
$fspec_file                           = File::FileUtil->os2fspec($fspec, $file, [$no_file])

$pm                                   = File::FileUtil->fspec2pm($fspec, $require_file)
($abs_file, $inc_path, $require_file) = File::FileUtil->pm2fspec($fspec, $pm)

@globed_files                         = File::FileUtil->fspec_glob($fspec, @files)

DESCRIPTION

Methods in this package, perform operations on file specifications for operating systems other then the current site operating system. The input variable $fspec tells the methods in this package the file specification for file names used as input to the methods. Thus, when using methods in this package, the method may load up to two File::Spec submodules methods and neither of them is a submodule for the current site operating system.

Supported operating system file specifications are as follows:

MacOS
MSWin32
os2
VMS
epoc

Of course since, the variable $^O contains the file specification for the current site operating system, it may be used for the $fspec variable.

fspec_glob method

@globed_files = File::FileUtil->fspec_glob($fspec, @files)

The fspec_glob method BSD globs each of the files in @files where the file specification for each of the files is $fspec.

fspec2fspec method

$to_file = File::FileUtil->fspec2fspec($from_fspec, $to_fspec $from_file, $nofile)

THe fspec2fspec method translate the file specification for $from_file from the $from_fspec to the $to_fpsce. Supplying anything for $nofile, tells the fspec2fspec method that $from_file is a directory tree; otherwise, it is a file.

fspec2os method

$os_file = File::FileUtil->fspec2os($fspec, $file, $no_file)

The fspec2os method translates a file specification, $file, from the current operating system file specification to the $fspec file specification. Supplying anything for $nofile, tells the fspec2fspec method that $from_file is a directory tree; otherwise, it is a file.

fspec2pm method

$pm_file = File::FileUtil->fspec2pm( $fspec, $relative_file )

The fspec2pm method translates a filespecification $file in the $fspce format to the Perl module formate.

os2fspec method

$file = File::FileUtil->os2fspec($fspec, $os_file, $no_file)

The fspec2os method translates a file specification, $file, from the current operating system file specification to the $fspec file specification. Supplying anything for $nofile, tells the fspec2fspec method that $from_file is a directory tree; otherwise, it is a file.

pm2file method

($abs_file, $inc_path, $require_file) = File::FileUtil->pm2file($pm)

The pm2file method returns the absolute file and the directory in @INC for a the program module $pm_file.

REQUIREMENTS

Coming soon.

DEMONSTRATION

~~~~~~ Demonstration overview ~~~~~

Perl code begins with the prompt

=>

The selected results from executing the Perl Code follow on the next lines. For example,

=> 2 + 2
4

~~~~~~ The demonstration follows ~~~~~

=>     use File::Spec;

=>     use File::Package;
=>     my $fp = 'File::Package';

=>     my $as = 'File::AnySpec';

=>     my $loaded = '';
=>     my @drivers;
=>     my @files;
=> my $errors = $fp->load_package( $as)
=> $errors
''

=> $as->fspec2fspec( 'Unix', 'MSWin32', 'File/FileUtil.pm')
'File\FileUtil.pm'

=> $as->os2fspec( 'Unix', ($as->fspec2os( 'Unix', 'File/FileUtil.pm')))
'File/FileUtil.pm'

=> $as->os2fspec( 'MSWin32', ($as->fspec2os( 'MSWin32', 'Test\\TestUtil.pm')))
'Test\TestUtil.pm'

=> @drivers = sort $as->fspec_glob('Unix','Drivers/G*.pm')
=> join (', ', @drivers)
'Drivers\Generate.pm'

=> $as->fspec2pm('Unix', 'File/AnySpec.pm')
'File::AnySpec'

=> $as->pm2fspec( 'Unix', 'File::Basename')
'/Perl/lib/File/Basename.pm'
'/Perl/lib'
'File/Basename.pm'

QUALITY ASSURANCE

The module "t::File::AnySpec" is the Software Test Description(STD) module for the "File::AnySpec". module.

To generate all the test output files, run the generated test script, run the demonstration script and include it results in the "File::AnySpec" POD, execute the following in any directory:

tmake -test_verbose -replace -run  -pm=t::File::AnySpec

Note that tmake.pl must be in the execution path $ENV{PATH} and the "t" directory containing "t::File::AnySpec" on the same level as the "lib" directory that contains the "File::AnySpec" module.

NOTES

AUTHOR

The holder of the copyright and maintainer is

<support@SoftwareDiamonds.com>

Copyrighted (c) 2002 Software Diamonds

All Rights Reserved

BINDING REQUIREMENTS NOTICE

Binding requirements are indexed with the pharse 'shall[dd]' where dd is an unique number for each header section. This conforms to standard federal government practices, 490A ("3.2.3.6" in STD490A). In accordance with the License, Software Diamonds is not liable for any requirement, binding or otherwise.

LICENSE

Software Diamonds permits the redistribution and use in source and binary forms, with or without modification, provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

SOFTWARE DIAMONDS, http::www.softwarediamonds.com, PROVIDES THIS SOFTWARE 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTWARE DIAMONDS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING USE OF THIS SOFTWARE, EVEN IF ADVISED OF NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE POSSIBILITY OF SUCH DAMAGE.

SEE_ALSO:

File::Spec
File::AnySpec