Command-Template
view release on metacpan or search on metacpan
lib/Command/Template.pod view on Meta::CPAN
=head2 B<< command_template >>
my $ct = command_template(qw{ galook <foo> <bar=N> [baz] [sil=Y] })
Returns a L<Command::Template::Instance> object with a C<generate>
method that performs the actual expansion, returning a list of strings
representing the command line.
=head2 B<< ct >>
Alias for L</command_template>.
=head1 EXTENDING
If extending C<Command::Template> is of interest, here are a few hints:
=over
=item *
class L<Command::Template::Instance> encapsulates parsing a command
template and expanding it for generating command lists, based on a hash
with values binding;
=item *
class L<Command::Template::Runner> provides a simple running facility
around L<Command::Template::Instance> that uses L<IPC::Run> to run
expanded commands, returning the result as a
L<Command::Template::Runner::Record> object.
=item *
class L<Command::Template::Runner::Record> provides accessors into the
outcome of a single run from L<Command::Template::Runner>.
=back
Possible reasons for expanding might be:
=over
=item *
different or additional rules for expansions are needed. If this is the
case, the alternative to L<Command::Template::Instance> must provide a
C<generate> method; L<Comman::Template::Runner> can still be used, as
long as a reference to the alternative object for the instance is passed
to the constructor.
=item *
a different running facility is needed. In this case, it suffices to
impelement a new runner class, leveraging L<Command::Template::Instance>
for the command expansion.
=back
=head1 BUGS AND LIMITATIONS
Minimum perl version 5.24.
Report bugs through GitHub (patches welcome) at
L<https://github.com/polettix/Command-Template>.
=head1 AUTHOR
Flavio Poletti <flavio@polettix.it>
=head1 COPYRIGHT AND LICENSE
Copyright 2021 by Flavio Poletti <flavio@polettix.it>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=cut
( run in 1.819 second using v1.01-cache-2.11-cpan-5837b0d9d2c )