NAME
Command::Template::Instance
SYNOPSIS
use Command::Template::Instance;
my @template = qw{ ls [options=-l] <dir> };
my $instance = Command::Template::Instance->new(@template);
# @c1 = qw< ls -l / >
my @c1 = $ct->generate(dir => '/');
# @c2 = qw< ls -la / >
my @c2 = $ct->generate(dir => '/etc', options => '-la');
# @c3 = @c4 = qw< ls /usr/bin >
my @c3 = $ct->generate(dir => '/usr/bin', options => undef);
my @c4 = $ct->generate(dir => '/usr/bin', options => []);
# @c5 = qw< ls -l -a /usr/bin >
my @c5 = $ct->generate(dir => '/usr/bin', options => [qw< -l -a >]);
DESCRIPTION
This class implements the main expansion mechanism for command templates.
INTERFACE
defaults
my $href = $obj->defaults;
$obj->defaults({...});
Get or set the default bindings for expansion. Returns or accepts a hash reference with key/value pairs representing the default bindings.
generate
my @command = $obj->generate(%bindings); # OR
my $command = $obj->generate(%bindings);
Expand the template according to the provided bindings and, if set, the default ones.
Returns a list of strings in list context, a reference to an array containing the list otherwise.
new
my $instance = Command::Template::Instance(@template);
Generate a new object, suitable for serially expand the provided @template
.
template
my $aref = $obj->template;
Get a copy of the template used for the expansion.
ANYTHING ELSE (INCLUDING AUTHOR, COPYRIGHT AND LICENSE)
See documentation for Command::Template.