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) );
$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.
$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:
Mary Ehlers <email@example.com>
This software is Copyright (c) 2017 by Mary Ehlers.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004