NAME
Form::Factory::Interface::CLI - Command-line interface builder for form factory
VERSION
version 0.022
SYNOPSIS
#/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;
}
DESCRIPTION
Provides a simple interface for building command-line tools that manipulate actions.
ATTRIBUTES
renderer
This is a subroutine responsible for returning the usage parameters back to the user. The default prints to STDOUT
.
get_args
This is a subroutine responsible for return a list of command-line arguments. The default implementation returns a reference to @ARGV
.
get_file
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
.
METHODS
render_control
Prints a usage line for each control.
consume_control
Consumes the command-line arguments and files specified on the command-line to fill in the action.
AUTHOR
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2015 by Qubling Software LLC.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.