Form::Factory::Interface::CLI - Command-line interface builder for form factory
version 0.008
#/usr/bin/perl use strict; use warnings; use Form::Factory; my $cli = Form::Factory->new_interface('CLI'); my $action = $cli->new_action(shift @ARGV); $action->consume_and_clean_and_check_and_process; if ($action->is_valid and $action->is_success) { print "done.\n"; } else { my $messages = $action->results->all_messages; print $messages; print "usage: $0 OPTIONS\n\n"; print "Options:\n"; $action->render; }
Provides a simple interface for building command-line tools that manipulate actions.
This is a subroutine responsible for returning the usage parameters back to the user. The default prints to STDOUT.
STDOUT
This is a subroutine responsible for return a list of command-line arguments. The default implementation returns a reference to @ARGV.
@ARGV
This is a subroutine responsible for returning the contents of files used on the command-line. It is passed the interface object and then the name of the file to load. The default implementation slurps up the named file or, in the case of the name begin "-", returns the contents of STDIN.
STDIN
Prints a usage line for each control.
Consumes the command-line arguments and files specified on the command-line to fill in the action.
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
<hanenkamp@cpan.org>
Copyright 2009 Qubling Software LLC.
This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.
To install Form::Factory, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Form::Factory
CPAN shell
perl -MCPAN -e shell install Form::Factory
For more information on module installation, please visit the detailed CPAN module installation guide.