line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ============================================================================ |
2
|
|
|
|
|
|
|
package MooseX::App::Plugin::Version; |
3
|
|
|
|
|
|
|
# ============================================================================ |
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
2985
|
use 5.010; |
|
4
|
|
|
|
|
14
|
|
6
|
4
|
|
|
4
|
|
24
|
use utf8; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
23
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
104
|
use namespace::autoclean; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
24
|
|
9
|
4
|
|
|
4
|
|
305
|
use Moose::Role; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
26
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub plugin_metaroles { |
12
|
3
|
|
|
3
|
0
|
9
|
my ($self,$class) = @_; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
return { |
15
|
3
|
|
|
|
|
11
|
class => ['MooseX::App::Plugin::Version::Meta::Class'], |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
around 'initialize_command_class' => sub { |
20
|
|
|
|
|
|
|
my $orig = shift; |
21
|
|
|
|
|
|
|
my $self = shift; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $return = $self->$orig(@_); |
24
|
|
|
|
|
|
|
if (blessed $return |
25
|
|
|
|
|
|
|
&& $return->isa('MooseX::App::Plugin::Version::Command')) { |
26
|
|
|
|
|
|
|
return $return->version($self); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
return $return; |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=encoding utf8 |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 NAME |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
MooseX::App::Plugin::Version - Adds a command to display the version and license of your application |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 SYNOPSIS |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
In your base class: |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
package MyApp; |
47
|
|
|
|
|
|
|
use MooseX::App qw(Version); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
In your shell |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
bash$ myapp version |
52
|
|
|
|
|
|
|
VERSION |
53
|
|
|
|
|
|
|
MyApp version 2.1 |
54
|
|
|
|
|
|
|
MooseX::App version 1.08 |
55
|
|
|
|
|
|
|
Perl version 5.16.2 |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
LICENSE |
58
|
|
|
|
|
|
|
This library is free software and may be distributed under the same terms |
59
|
|
|
|
|
|
|
as perl itself. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 DESCRIPTION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This plugin adds a command to display the version of your application, |
64
|
|
|
|
|
|
|
MooseX::App and perl. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Furthermore it tries to parse the Pod of the base class and extract |
67
|
|
|
|
|
|
|
LICENSE, AUTHOR and COPYRIGHT sections |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |