Name
Class::Usul::TraitFor::RunningMethods - Try and run a method catch and handle any exceptions
Synopsis
use Moo;
extends 'Class::Usul';
with 'Class::Usul::TraitFor::RunningMethods';
Description
Implements the "run" method which calls the target method in a try / catch block. Handles any resulting exceptions
Configuration and Environment
Defines the following command line options;
c method
-
The method in the subclass to dispatch to
o options key=value
-
The method that is dispatched to can access the key/value pairs from the
$self->options
hash ref umask
-
An octal number which is used to set the umask by the "run" method
v verbose
-
Repeatable boolean that increases the verbosity of the output
Defines the following attributes;
params
-
A hash reference keyed by method name. The values are array references which are flattened and passed to the method call by "run"
Subroutines/Methods
run
$exit_code = $self->run;
Call the method specified by the -c
option on the command line. Returns the exit code
run_chain
$exit_code = $self->run_chain( $method );
Called by "run" when "select_method" cannot determine which method to call. Outputs usage if method
is undefined. Logs an error if method
is defined but not (by definition a callable method). Returns exit code FAILED
select_method
$method = $self->select_method;
Called by "run" it examines the "method" attribute and if necessary the extra command line arguments to determine the method to call
Diagnostics
None
Dependencies
Incompatibilities
There are no known incompatibilities in this module
Bugs and Limitations
There are no known bugs in this module. Please report problems to http://rt.cpan.org/NoAuth/Bugs.html?Dist=Class-Usul. Patches are welcome
Acknowledgements
Larry Wall - For the Perl programming language
Author
Peter Flanigan, <pjfl@cpan.org>
License and Copyright
Copyright (c) 2016 Peter Flanigan. All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic
This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE