NAME

Meta::Utils::File::Path - module to handle path names.

COPYRIGHT

Copyright (C) 2001, 2002 Mark Veltzer; All rights reserved.

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.

DETAILS

MANIFEST: Path.pm
PROJECT: meta
VERSION: 0.29

SYNOPSIS

package foo;
use Meta::Utils::File::Path qw();
my($full)=Meta::Utils::File::Path::add_path("/usr/bin:/bin","/sbin:/usr/sbin",":");

DESCRIPTION

This package is intended to help you handle paths. For example - remove automounted parts from your path, get cannonic paths, get absolute paths, get paths with as few ".." as possible, reduce paths to a minimum etc...

FUNCTIONS

add_path($$$)
add_path_min($$$)
min_path($$)
exists($$$)
exists_dir($$$)
resolve_nodie($$$)
resolve($$$)
resolve_dir_nodie($$$)
resolve_dir($$$)
append($$$)
remove_path($$$)
remove_nonexist($$)
TEST($)

FUNCTION DOCUMENTATION

add_path($$$)

This functions receives: 1. A first path component. 2. A second path component. 3. A separator used for those paths. And returns a path which is the catenation of those two paths. If one of them is nothing then the extra separator will be ommited.

add_path_min($$$)

This method does exactly as add_path except it also minimizes the path of the catenation if indeed catenation takes place (if no catenation takes place the path is kept the same as the first or second element which must be already minimized if you with the result ot be minimized).

min_path($$)

This function receives: 0. A string which is a path name. 1. A separator. This function assumes that the string is a path name with the second argument is the separator and returns a string which is in effect the same path but has no two entries which are the same. The algorithm is to construct a new path and remember the old parts as not to repeat them.

exists($$$)

This method returns true iff the file exists in the path.

exists_dir($$$)

This method returns true iff the directory exists in the path.

resolve_nodie($$$)

This method receives a path and a file and returns the resolution of them: meaning the abosolute file name of the first file in the path that matches the file.

resolve($$$)

This method is the same as resolve_nodie expect it dies if it cannot find the file.

append($$$)

This will append a suffix to the path. This means all elements in the path.

remove_path($$$)

This method reveices a path (and a separator) and a path name. The method assumes that file is in one of the elements in the path and returns the relative part of the file name.

remove_nonexist($$)

This method return a path which is like the original given to it except it removes the parts of the path which are not real directories.

TEST($)

Test suite for this module.

SUPER CLASSES

None.

BUGS

None.

AUTHOR

Name: Mark Veltzer
Email: mailto:veltzer@cpan.org
WWW: http://www.veltzer.org
CPAN id: VELTZER

HISTORY

0.00 MV initial code brought in
0.01 MV make quality checks on perl code
0.02 MV more perl checks
0.03 MV check that all uses have qw
0.04 MV fix todo items look in pod documentation
0.05 MV more on tests/more checks to perl
0.06 MV perl code quality
0.07 MV more perl quality
0.08 MV chess and code quality
0.09 MV more perl quality
0.10 MV perl documentation
0.11 MV more perl quality
0.12 MV perl qulity code
0.13 MV more perl code quality
0.14 MV revision change
0.15 MV languages.pl test online
0.16 MV web site and docbook style sheets
0.17 MV perl packaging
0.18 MV perl packaging again
0.19 MV tree type organization in databases
0.20 MV md5 project
0.21 MV database
0.22 MV perl module versions in files
0.23 MV movies and small fixes
0.24 MV thumbnail user interface
0.25 MV more thumbnail issues
0.26 MV paper writing
0.27 MV website construction
0.28 MV web site automation
0.29 MV SEE ALSO section fix

SEE ALSO

Meta::Utils::Output(3), Meta::Utils::System(3), Meta::Utils::Utils(3), strict(3)

TODO

Nothing.