| 1 | package App::CLI::Command::Version; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 1 | ▶ | use base qw/App::CLI::Command/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | App::CLI::Command::Version - Print a preformatted version string | ||
| 11 | |||
| 12 | =head1 SYNOPSIS | ||
| 13 | |||
| 14 | package MyApp; | ||
| 15 | use base qw(App::CLI App::CLI::Command); | ||
| 16 | |||
| 17 | use constant alias => ( | ||
| 18 | '--version' => '+App::CLI::Command::Version', | ||
| 19 | 'version' => '+App::CLI::Command::Version', | ||
| 20 | # Other aliases | ||
| 21 | ); | ||
| 22 | |||
| 23 | # Your app now supports a default version command and option | ||
| 24 | |||
| 25 | =head1 DESCRIPTION | ||
| 26 | |||
| 27 | This is package provides a default C<version> command modelled after | ||
| 28 | that of L<App::Cmd>. You can modify the default message by subclassing | ||
| 29 | this command and overriding its C<run> method, or by modifying it with | ||
| 30 | eg. L<Class::Method::Modifiers>. | ||
| 31 | |||
| 32 | =cut | ||
| 33 | |||
| 34 | 2 | ▶ | sub run { |
|
Subroutine
run: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 35 | 2 | my ($self) = shift; | |
| 36 | 1 | ▶ | no strict 'refs'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 37 | 2 | print sprintf "%s (%s) version %s (%s)\n", | |
| 38 | $self->app->prog_name, ref $self->app, $self->app->VERSION, $0; | ||
| 39 | } | ||
| 40 | |||
| 41 | 1 | 1; | |