| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package App::CLI::Command::Version; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 893 | use strict; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 40 |  | 
| 4 | 1 |  |  | 1 |  | 9 | use warnings; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 46 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 1 |  |  | 1 |  | 9 | use base qw/App::CLI::Command/; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 177 |  | 
| 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 command modelled after | 
| 28 |  |  |  |  |  |  | that of L. You can modify the default message by subclassing | 
| 29 |  |  |  |  |  |  | this command and overriding its C method, or by modifying it with | 
| 30 |  |  |  |  |  |  | eg. L. | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | =cut | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | sub run { | 
| 35 | 2 |  |  | 2 | 0 | 6 | my ($self) = shift; | 
| 36 | 1 |  |  | 1 |  | 9 | no strict 'refs'; | 
|  | 1 |  |  |  |  | 4 |  | 
|  | 1 |  |  |  |  | 157 |  | 
| 37 | 2 |  |  |  |  | 9 | print sprintf "%s (%s) version %s (%s)\n", | 
| 38 |  |  |  |  |  |  | $self->app->prog_name, ref $self->app, $self->app->VERSION, $0; | 
| 39 |  |  |  |  |  |  | } | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | 1; |