App::Base::Script - A truly lazy person's tool for writing self-documenting, self-monitoring scripts
package MyScript; use Moose; with 'App::Base::Script'; sub documentation { return 'This is a script.'; } sub script_run { my $self = shift; # do something return 0; } no Moose; __PACKAGE__->meta->make_immutable; package main; exit MyScript->new()->run();
App::Base::Script builds on App::Base::Script::Common and provides common infrastructure that is useful for writing scripts.
See also, App::Base::Script::Common "REQUIRED METHODS"
The code that actually executes the meat of the script. When a App::Base::Script is invoked by calling run(), all of the relevant options parsing and error handling is performed and then control is handed over to the script_run() method. The return value of script_run() is returned as the return value of run().
(See App::Base::Script::Common::new)
Handles errors generated by the script. This results in a call to App::Base::Script::Common::__error, which exits.
Invocation of a App::Base::Script-based script is accomplished as follows:
Define a class that implements the App::Base::Script interface (using 'with App::Base::Script')
Instantiate an object of that class via new()
Run the script by calling run(). The return value of run() is the exit status of the script, and should typically be passed back to the calling program via exit()
(See App::Base::Script::Common, "Options handling")
Copyright (C) 2010-2014 Binary.com
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install App::Base, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::Base
CPAN shell
perl -MCPAN -e shell install App::Base
For more information on module installation, please visit the detailed CPAN module installation guide.