The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

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

SYNOPSIS

use App::Framework ;

# VERSION
our $VERSION = '1.001' ;

# Create application and run it
App::Framework->new()->go() ;

#----------------------------------------------------------------
# Define run subroutine, automatically called by App:Script->go()
sub run
{
	my ($app) = @_ ;
	
	my %opts = $app->options() ;
	my @namelist = @{$app->arglist()}; 

	# DO APPLICATION HERE
	
}

#----------------------------------------------------------------
# Define main script information & all application options
__DATA__

[HISTORY]

30-May-08	SDP		Re-written to use App::Framework::Script 
28-May-08   SDP		New

[SUMMARY]

List (and repair) any faulty rrd database files

[SYNOPSIS]

$name [options] <rrd file(s)>

[OPTIONS]

-d|'dir'=s	temp directory	[default=/tmp]

Specify the directory in which to store the xml output files (created by dumping the rrd databases)

-repair 	Enable rrd repair

When this option is specified, causes the script to repair any faulty rrd files


[DESCRIPTION]

Scans the specified rrd directory and lists any files which are 'faulty'. 

Optionally this script can also repair the fault by setting the value to NaN.

An export RRD database in XML file is of the form:

  <!-- Round Robin Database Dump --><rrd>	<version> 0003 </version>
	<step> 300 </step> <!-- Seconds -->
	<lastupdate> 1211355308 </lastupdate> <!-- 2008-05-21 08:35:08 BST -->

DESCRIPTION

Derived object from App::Framework::Base. 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::Base->uage(). This function calls pod2usage to display help, man page etc.

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!

INTERFACE

App::Framework::Modules::Script->new([%args])

Create a new App::Framework::Modules::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

App::Framework::Modules::Script->allowed_class_instance()

Class instance object is not allowed

OBJECT METHODS

App::Framework::Modules::Script->options([$options_aref])

Adds some extra script-related default options.

Set options based on the ARRAY ref specification.

Each entry in the ARRAY is an ARRAY ref containing:

[ <option spec>, <option summary>, <option description> ]

Where the <option spec> is in the format used by Getopt::Long

NOTE: The <option spec> also determines the name of the field used to store the option value/flag. If alternatives are specified, then the first one is used. Alternatively, if any alternative is marked with quotes, then that is the one used.

Examples:

dir|d|directory	- Field name is 'dir'
dir|d|'directory'	- Field name is 'directory'

When no arguments are specifed, returns the hash of options/values

App::Framework::Modules::Script->exit()

Exit the application.

App::Framework::Modules::Script->catch_error($error)

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

App::Framework::Modules::Script->run_cmd($cmd, [$cmd_args, [$exit_on_fail]])

Execute a specified command, return either the exit status [0=success] (in scalar context) or the array of lines output by the command (in array context)

If $exit_on_fail is set, then this routine reports the run results and exits if the return status is not 0

NOTE: This interface is DIFFERENT to that employed by the underlying Run object. This form is meant to be easier to use for Applications.

App::Framework::Modules::Script->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)

1 POD Error

The following errors were encountered while parsing the POD:

Around line 205:

=over without closing =back