| Description | A static content generator. |

Newcomen::Util::Path - Path related utility functions.

use Newcomen::Util::Path;
# Get the resolved absolute path:
my $abs_path = Newcomen::Util::Path::resolute ($path);
# Check if some file is located beneath this path:
if (contains_file ($abs_path, $file)) {
# do something...
}
This package provides utility functions dealing with paths. Note that all functions may be imported into the package using Newcomen::Util::Path:
use Newcomen::Util::List qw( contains_dir contains_file resolute );
No function is exported by default.

Toggle sources: contains_dir contains_file
sub contains_dir {
my $parent = shift;
my $child = shift;
return ($parent -> contains ($child) and -d $child -> stringify ());
}sub contains_file {
my $parent = shift;
my $child = shift;
return ($parent -> contains ($child) and -f $child -> stringify ());
}if (contains_dir ($ancestor, $descendant)) {
# do something...
}
# Same for contains_file()...These functions will check if the directory or file represented by the Path::Class instance specified as the second parameter is a direct or indirect child of the directory represented by the Path::Class::Dir instance specified as the first parameter. For both directories and files it will be checked if they actually exist on the file system.
Toggle source: resolute
sub resolute { $_ [0] -> resolve () -> absolute () }my $abs_path = resolute ($path);
Expects a Path::Class::Dir or Path::Class::File instance as first and only parameter, and returns a new instance with the path resolved and converted to an absolute path, by chaining the two Path::Class methods resolve() and absolute(). See Path::Class::Dir and/or Path::Class::File for details.

Path::Class, Path::Class::Dir, Path::Class::File

This is version 2014101201.

Stefan Goebel - newcomen {at} subtype {dot} de

Copyright 2013-2014 Stefan Goebel.
This file is part of Newcomen.
Newcomen 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 3 of the license, or (at your option) any later version.
Newcomen 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 Newcomen. If not, see <http://www.gnu.org/licenses/>.