line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## no critic (RequireUseStrict) |
2
|
|
|
|
|
|
|
package MooseX::Getopt::Explicit; |
3
|
|
|
|
|
|
|
$MooseX::Getopt::Explicit::VERSION = '0.03'; |
4
|
|
|
|
|
|
|
## use critic (RequireUseStrict) |
5
|
2
|
|
|
2
|
|
3040
|
use Moose::Role; |
|
2
|
|
|
|
|
9566
|
|
|
2
|
|
|
|
|
8
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
with 'MooseX::Getopt'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
around _compute_getopt_attrs => sub { |
10
|
|
|
|
|
|
|
my ( $orig, $self, @args ) = @_; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my @attrs = $self->$orig(@args); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
return grep { |
15
|
|
|
|
|
|
|
$_->does('MooseX::Getopt::Meta::Attribute::Trait') |
16
|
|
|
|
|
|
|
} @attrs; |
17
|
|
|
|
|
|
|
}; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
1; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=pod |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=encoding UTF-8 |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
MooseX::Getopt::Explicit - MooseX::Getopt, but without implicit option generation [DEPRECATED] |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 VERSION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
version 0.03 |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 SYNOPSIS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
use Moose; |
36
|
|
|
|
|
|
|
with 'MooseX::Getopt::Explicit'; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
has foo => ( |
39
|
|
|
|
|
|
|
is => 'rw', |
40
|
|
|
|
|
|
|
); # Does *not* cause a Getopt option to be generated! |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has bar => ( |
43
|
|
|
|
|
|
|
is => 'ro' |
44
|
|
|
|
|
|
|
isa => 'Str', |
45
|
|
|
|
|
|
|
traits => ['Getopt'], |
46
|
|
|
|
|
|
|
); # *Does* cause a Getopt option to be generated! |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 DESCRIPTION |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
B<NOTE> I didn't know about L<MooseX::Getopt::Strict> when I wrote this; use |
51
|
|
|
|
|
|
|
that instead! |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
L<MooseX::Getopt> is nice, but I don't care for how it creates a command |
54
|
|
|
|
|
|
|
line option for every attribute in my classes unless explicitly overridden. |
55
|
|
|
|
|
|
|
So this role does the opposite: it requires C<traits =E<gt> ['Getopt']> in |
56
|
|
|
|
|
|
|
order for a command line option to be generated. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 SEE ALSO |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
L<MooseX::Getopt> |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
L<MooseX::Getopt::Strict> - when using this, give attributes |
63
|
|
|
|
|
|
|
a C<Getopt> metaclass if you want it to get a command-line option. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 AUTHOR |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Rob Hoelz <rob@hoelz.ro> |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
This software is copyright (c) 2012 by Rob Hoelz. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
74
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 BUGS |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website |
79
|
|
|
|
|
|
|
https://github.com/hoelzro/moosex-getopt-explicit/issues |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
82
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
83
|
|
|
|
|
|
|
feature. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
__END__ |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# ABSTRACT: MooseX::Getopt, but without implicit option generation [DEPRECATED] |
90
|
|
|
|
|
|
|
|