App::Framework::Core::Script - App::Framework command line script personality


NAME

App::Framework::Core::Script - App::Framework command line script personality


SYNOPSIS


DESCRIPTION

Derived object from App::Framework::Core. Should only be called via App::Framework import.

Adds command line script specific additions to base properties. Adds the following additional options:

        'log|L=s'                       Specify a log file
        'v|"verbose"'           Make script output more verbose
        'dryrun|"norun"'        Do not execute anything that would alter the file system, just show the commands that would have executed
        
Defines the exit() method which just calls standard exit.

Defines a usage_fn which gets called by App::Framework::Core->uage(). This function calls pod2usage to display help, man page etc.

FIELDS

None

CONSTRUCTOR METHODS

new([%args])

Create a new App::Framework::Script.

The %args are specified as they would be in the set method, for example:

        'mmap_handler' => $mmap_handler

The full list of possible arguments are :

        'fields'        => Either ARRAY list of valid field names, or HASH of field names with default values

CLASS METHODS

allowed_class_instance()

Class instance object is not allowed


=cut

sub allowed_class_instance { return 0 ; }

#============================================================================================

OBJECT METHODS

exit()

Exit the application.


=cut

sub exit { my $this = shift ; my ($exit_code) = @_ ;

print "EXIT: $exit_code\n" if $this->debug ;

        my $exit_type = $this->exit_type() ;
        if (lc($exit_type) eq 'die')
        {
                die '' ;
        }
        else
        {
                exit $exit_code ;
        }

}

#----------------------------------------------------------------------------

catch_error($error)

Function that gets called on errors. $error is as defined in the App::Framework::Base::Object::ErrorHandle manpage

script_usage($level)

Show usage.

$level is a string containg the level of usage to display

        'opt' is equivalent to pod2usage(2)
        'help' is equivalent to pod2usage(1)
        'man' is equivalent to pod2usage(-verbose => 2)


DIAGNOSTICS

Setting the debug flag to level 1 prints out (to STDOUT) some debug messages, setting it to level 2 prints out more verbose messages.


AUTHOR

Steve Price <sdprice at cpan.org>


BUGS

None that I know of!

 App::Framework::Core::Script - App::Framework command line script personality