line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Getopt::Alt::Command; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Created on: 2010-03-25 18:04:47 |
4
|
|
|
|
|
|
|
# Create by: Ivan Wills |
5
|
|
|
|
|
|
|
# $Id$ |
6
|
|
|
|
|
|
|
# $Revision$, $HeadURL$, $Date$ |
7
|
|
|
|
|
|
|
# $Revision$, $Source$, $Date$ |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
2097
|
use Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
10
|
1
|
|
|
1
|
|
6867
|
use version; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
11
|
1
|
|
|
1
|
|
77
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
74
|
|
12
|
1
|
|
|
1
|
|
6
|
use English qw/ -no_match_vars /; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = version->new('0.5.3'); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has cmd => ( |
17
|
|
|
|
|
|
|
is => 'ro', |
18
|
|
|
|
|
|
|
isa => 'Str', |
19
|
|
|
|
|
|
|
required => 1, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
has module => ( |
22
|
|
|
|
|
|
|
is => 'ro', |
23
|
|
|
|
|
|
|
isa => 'Str', |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
has method => ( |
26
|
|
|
|
|
|
|
is => 'ro', |
27
|
|
|
|
|
|
|
isa => 'Str', |
28
|
|
|
|
|
|
|
default => 'run', |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
has run => ( |
31
|
|
|
|
|
|
|
is => 'ro', |
32
|
|
|
|
|
|
|
isa => 'CodeRef', |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
has options => ( |
35
|
|
|
|
|
|
|
is => 'rw', |
36
|
|
|
|
|
|
|
isa => 'ArrayRef[Getopt::Alt::Option]', |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
around BUILDARGS => sub { |
40
|
|
|
|
|
|
|
my ($orig, $class, @params) = @_; |
41
|
|
|
|
|
|
|
my %param = |
42
|
|
|
|
|
|
|
@params == 1 && ref $params[0] eq 'HASH' ? %{ $params[0] } |
43
|
|
|
|
|
|
|
: @params == 1 && ref $params[0] ne 'HASH' ? ( cmd => $params[0] ) |
44
|
|
|
|
|
|
|
: @params; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
return $class->$orig(%param); |
47
|
|
|
|
|
|
|
}; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 NAME |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Getopt::Alt::Command - Base for sub commands |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 VERSION |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
This documentation refers to Getopt::Alt::Command version 0.5.3. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 SYNOPSIS |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
use Getopt::Alt::Command; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# Brief but working code example(s) here showing the most common usage(s) |
67
|
|
|
|
|
|
|
# This section will be as far as many users bother reading, so make it as |
68
|
|
|
|
|
|
|
# educational and exemplary as possible. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 DESCRIPTION |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 DIAGNOSTICS |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 CONFIGURATION AND ENVIRONMENT |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
There are no known bugs in this module. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Please report problems to Ivan Wills (ivan.wills@gmail.com). |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Patches are welcome. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 AUTHOR |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Ivan Wills - (ivan.wills@gmail.com) |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Copyright (c) 2010 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077). |
100
|
|
|
|
|
|
|
All rights reserved. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under |
103
|
|
|
|
|
|
|
the same terms as Perl itself. See L<perlartistic>. This program is |
104
|
|
|
|
|
|
|
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
105
|
|
|
|
|
|
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
106
|
|
|
|
|
|
|
PARTICULAR PURPOSE. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=cut |