Path::Abstract

Path::Abstract is a fast and featurefull class for UNIX-style path manipulation.
Download

Path::Abstract Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Robert Krimen
  • Publisher web site:
  • http://search.cpan.org/~rkrimen/

Path::Abstract Tags


Path::Abstract Description

Path::Abstract is a fast and featurefull class for UNIX-style path manipulation. Path::Abstract is a fast and featurefull class for UNIX-style path manipulation.SYNOPSIS use Path::Abstract; my $path = Path::Abstract->new("/apple/banana"); # $parent is "/apple" my $parent = $path->parent; # $cherry is "/apple/banana/cherry.txt" my $cherry = $path->child("cherry.txt");Path::Abstract->new( < path> ) Path::Abstract->new( < part>, )Create a new Path::Abstract object using < path> or by joining each < part> with "/"Returns the new Path::Abstract objectPath::Abstract::path( < path> ) Path::Abstract::path( < part>, )Create a new Path::Abstract object using < path> or by joining each < part> with "/"Returns the new Path::Abstract object$path->cloneReturns an exact copy of $path$path->set( < path> ) $path->set( < part>, )Set the path of $path to < path> or the concatenation of each < part> (separated by "/")Returns $path$path->is_nil $path->is_emptyReturns true if $path is equal to ""$path->is_rootReturns true if $path is equal to "/"$path->is_treeReturns true if $path begins with "/" path("/a/b")->is_tree # Returns true path("c/d")->is_tree # Returns false$path->is_branchReturns true if $path does NOT begin with a "/" path("c/d")->is_branch # Returns true path("/a/b")->is_branch # Returns false$path->to_treeChange $path by prefixing a "/" if it doesn't have one alreadyReturns $path$path->to_branchChange $path by removing a leading "/" if it has oneReturns $path$path->list $path->splitReturns the path in list form by splitting at each "/" path("c/d")->list # Returns ("c", "d") path("/a/b/")->last # Returns ("a", "b")$path->firstReturns the first part of $path up to the first "/" (but not including the leading slash, if any) path("c/d")->first # Returns "c" path("/a/b")->first # Returns "a"$path->lastReturns the last part of $path up to the last "/" path("c/d")->last # Returns "d" path("/a/b/")->last # Returns "b"path $path->get $path->stringifyReturns the path in string or scalar form path("c/d")->list # Returns "c/d" path("/a/b/")->last # Returns "/a/b"$path->push( < part>, ) $path->down( < part>, )Modify $path by appending each < part> to the end of $path, separated by "/"Returns $path$path->child( < part>, )Make a copy of $path and push each < part> to the end of the new path.Returns the new child path$path->pop( < count> )Modify $path by removing < count> parts from the end of $pathReturns the removed path as a Path::Abstract object$path->up( < count> )Modify $path by removing < count> parts from the end of $pathReturns $path$path->parent( < count> )Make a copy of $path and pop < count> parts from the end of the new pathReturns the new parent path$path->file $path->file( < part>, )Create a new Path::Class::File object using $path as a base, and optionally extending it by each < part>Returns the new file object$path->dir $path->dir( < part>, )Create a new Path::Class::Dir object using $path as a base, and optionally extending it by each < part>Returns the new dir object Requirements: · Perl


Path::Abstract Related Software