line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ============================================================================ |
2
|
|
|
|
|
|
|
package MooseX::App::Plugin::Version; |
3
|
|
|
|
|
|
|
# ============================================================================ |
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
2928
|
use 5.010; |
|
4
|
|
|
|
|
17
|
|
6
|
4
|
|
|
4
|
|
24
|
use utf8; |
|
4
|
|
|
|
|
45
|
|
|
4
|
|
|
|
|
25
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
113
|
use namespace::autoclean; |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
26
|
|
9
|
4
|
|
|
4
|
|
300
|
use Moose::Role; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
40
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub plugin_metaroles { |
12
|
3
|
|
|
3
|
0
|
13
|
my ($self,$class) = @_; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
return { |
15
|
3
|
|
|
|
|
12
|
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 |