Piper::Path - Simple path object for labeling locations in Piper pipelines
use Piper::Path; # grandparent/parent/child my $path = Piper::Path->new(qw( grandparent parent child )); # grandparent/parent/child/grandchild $path->child('grandchild'); # (qw(grandparent parent child)) $path->split; # child $path->name; # 'grandparent/parent/child' $path->stringify; "$path";
Simple filesystem-like representation of a pipeline segment's placement in the pipeline, relative to containing segments.
Creates a Piper::Path object from the given path segments.
Segments may be single path elements (similar to a file name), joined path elements (with /), or Piper::Path objects.
/
The following examples create equivalent objects:
Piper::Path->new(qw(grandparent parent child)); Piper::Path->new(qw(grandparent/parent child)); Piper::Path->new( Piper::Path->new(qw(grandparent parent)), qw(child) );
Returns a new Piper::Path object representing the appropriate child of $self.
$path # grampa/parent $path->child(qw(child)) # grampa/parent/child
Returns the last segment of the path, similar to the basename of a filesystem path.
basename
$path # foo/bar/baz $path->name # baz
Returns an array of the path segments.
$path # foo/bar/baz $path->split # qw(foo bar baz)
Returns a string representation of the path, which is simply a join of the path segments with /.
String context is overloaded to call this method. The following are equivalent:
$path->stringify "$path"
version 0.05
Mary Ehlers <ehlers@cpan.org>
This software is Copyright (c) 2017 by Mary Ehlers.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
To install Piper, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Piper
CPAN shell
perl -MCPAN -e shell install Piper
For more information on module installation, please visit the detailed CPAN module installation guide.