NAME

Meta::Utils::File::Patho - Path object.

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: Patho.pm
PROJECT: meta
VERSION: 0.08

SYNOPSIS

package foo;
use Meta::Utils::File::Patho qw();
my($object)=Meta::Utils::File::Patho->new();
my($result)=$object->method();

DESCRIPTION

This module gives you an object which encapsulates a path.

A Path is an ordered set of directories used to enable hierarchical search for files (executables, source files etc). This path object is exactly that - an ordered set of directories. You can initialize the object from a string and a separator, from an environment variable or by adding the components yourself. After that you can resolve a file name according to the path and perform other operations.

FUNCTIONS

new($)
new_data($$$)
new_env($$$)
new_path($)
minimize($)
exists($$)
resolve($$)
path_to($$)
mtime($$)
append_data($$$)
append($$)
check($)
compose($$)
TEST($)

FUNCTION DOCUMENTATION

new($)

This is a constructor for the Meta::Utils::File::Patho object.

new_data($$$)

Give this constructor a path and a separator and you'll get a path object initialized for that path.

new_env($$$)

This method will create a new instance from data taken from an environment variable. You have to supply the separator yourself.

new_path($)

This method will create a new instance from the envrionment PATH variable.

minimize($)

This method will remove redundant componets in the path. Redundant components in the path are components which repeat them selves. The paths structure (the order of resolution) will remain the same.

exists($$)

This method will returns whether a file given exists according to the path. The file can have directory components in it and must be relative to the path.

resolve($$)

This method will return a file resolved according to a path.

path_to($$)

This method will return the path to a certain executable according to the current path object.

mtime($$)

This method will return the files resolved modification time.

append_data($$$)

This method will append a path to the end of the current one.

append($$)

This method appends a piece of data to every element of the path.

check($)

This method will check that each component in the path is indeed a directory.

compose($$)

This method will return a string describing the path using the separator specified.

TEST($)

Test suite for this module.

SUPER CLASSES

Meta::Ds::Array(3)

BUGS

None.

AUTHOR

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

HISTORY

0.00 MV md5 progress
0.01 MV thumbnail user interface
0.02 MV more thumbnail issues
0.03 MV website construction
0.04 MV web site automation
0.05 MV SEE ALSO section fix
0.06 MV web site development
0.07 MV teachers project
0.08 MV md5 issues

SEE ALSO

Meta::Ds::Array(3), Meta::Utils::Env(3), strict(3)

TODO

-in the check method also check that the components are ABSOLUTE directory names.

-write the minimize method.

-in the minimize method convert the elements into some kind of cannonical representation so I'll know that two directory names are not the same name for the same directory.

-write a method to find files in paths which are not executables.