| 1 | package Log::Munger::App::Command; | ||||||||||
| 2 | 16 | ▶ | use App::Cmd::Setup -command; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | =head1 NAME | ||||||||||
| 5 | |||||||||||
| 6 | Log::Munger::App::Command - Base class for log_munger subcommands. | ||||||||||
| 7 | |||||||||||
| 8 | =cut | ||||||||||
| 9 | |||||||||||
| 10 | # The App::Cmd validation hook. Handles --help by dispatching to the help | ||||||||||
| 11 | # command for the current subcommand and exiting, then hands everything else to | ||||||||||
| 12 | # the subcommand's own validate method. | ||||||||||
| 13 | # | ||||||||||
| 14 | # Args: | ||||||||||
| 15 | # | ||||||||||
| 16 | # - $opt :: The parsed options hash ref, as App::Cmd passes it. | ||||||||||
| 17 | # | ||||||||||
| 18 | # - $args :: Array ref of the remaining command line args. | ||||||||||
| 19 | # | ||||||||||
| 20 | # Returns whatever the subcommand's validate returns, or exits for --help. | ||||||||||
| 21 | 16 | ▶ | sub validate_args { | ||||||||
|
Subroutine
validate_args: called CC=2 SCAR=9.2
Pod
documented
| |||||||||||
| 22 | 16 | my ( $self, $opt, $args ) = @_; | |||||||||
| 23 | 16 | ▶ | if ( $opt->{help} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 0 | my ($command) = $self->command_names; | |||||||||
| 25 | 0 | $self->app->execute_command( $self->app->prepare_command( "help", $command ) ); | |||||||||
| 26 | 0 | exit; | |||||||||
| 27 | } | ||||||||||
| 28 | 16 | $self->validate( $opt, $args ); | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 16 | return 1; | |||||||||