IPC::PrettyPipe::Arg - An argument to an IPC::PrettyPipe::Cmd command
use IPC::PrettyPipe::Arg; # standard constructor $arg = IPC::PrettyPipe::Arg->new( name => $name, value => $value, %attr ); # concise constructors $arg = IPC::PrettyPipe::Arg->new( $name ); $arg = IPC::PrettyPipe::Arg->new( [ $name, $value ] ); # perform value substitution $arg->valsubst( $pattern, $rep ); # return a rendered argument $arg->render;
IPC::PrettyPipe::Arg objects are containers for arguments to commands in an IPC::PrettyPipe::Cmd object.
# named parameters; may provide additional attributes $arg = IPC::PrettyPipe::Arg->new( \%attr ); # concise interface $arg = IPC::PrettyPipe::Arg->new( $name ); # switch arg $arg = IPC::PrettyPipe::Arg->new( [ $name, $value ] ); # arg w/ value
The available attributes are:
Required. The name of the argument.
The value of the argument. If an argument is a switch, no value is required.
A string prefix to be applied to the argument name before being rendered. This is often
A prefix is not required (the argument name may already have it). This attribute is useful when creating arguments from hashes where the keys do not contain a prefix.
A string to insert between the argument name and value when rendering. In some cases arguments must be a single string where the name and value are separated with an
=character; in other cases they are treated as separate entities. If
undefit indicates that they are treated as separate entities. It defaults to
$current_value = $self->pfx; $self->pfx( $new_value );
Get or set the value of the
$current_value = $self->sep; $self->sep( $new_value );
Get or set the value of the
$name = $self->name;
The argument's name;
$name = $self->quoted_name;
The argument's name, appropriately quoted for passing as a single word to a Bourne compatible shell.
$value = $self->value;
The argument's value;
$value = $self->quoted_value;
The argument's value, appropriately quoted for passing as a single word to a Bourne compatible shell.
$bool = $self->has_value
Returns true if the argument has been assigned a value.
$bool = $self->has_blank_value
Returns true if the value is the empty string.
@rendered_arg = $arg->render;
Render the argument. If the argument's
sepattribute is defined, render returns a string which looks like:
$pfx . $name . $sep . $value
sepis not defined, it returns an array ref which looks like
$pfx . $name, $value
$bool = $arg->valmatch( $pattern );
Returns true if the argument has a value and it matches the passed regular expression.
$arg->valsubst( $pattern, $rep );
If the argument has a value, perform the equivalent to
$value =~ s/$pattern/$rep/;
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=IPC-PrettyPipe or by email to bug-IPC-PrettyPipe@rt.cpan.org.
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
Please see those modules/websites for more information related to this module.
Diab Jerius <firstname.lastname@example.org>
This software is Copyright (c) 2018 by Smithsonian Astrophysical Observatory.
This is free software, licensed under:
The GNU General Public License, Version 3, June 2007