line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooX::Cmd::ChainedOptions::Role; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: generate per-command roles to handle chained options |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
14
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
55
|
|
6
|
2
|
|
|
2
|
|
14
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
103
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Package::Variant |
11
|
2
|
|
|
|
|
20
|
importing => ['Moo::Role'], |
12
|
2
|
|
|
2
|
|
1024
|
subs => [ 'has', 'with' ]; |
|
2
|
|
|
|
|
7995
|
|
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
2
|
|
1392
|
use namespace::clean -except => [ 'build_variant' ]; |
|
2
|
|
|
|
|
17899
|
|
|
2
|
|
|
|
|
26
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#pod =pod |
17
|
|
|
|
|
|
|
#pod |
18
|
|
|
|
|
|
|
#pod =for pod-coverage |
19
|
|
|
|
|
|
|
#pod |
20
|
|
|
|
|
|
|
#pod =head2 make_variant |
21
|
|
|
|
|
|
|
#pod |
22
|
|
|
|
|
|
|
#pod =head2 build_variant |
23
|
|
|
|
|
|
|
#pod |
24
|
|
|
|
|
|
|
#pod =cut |
25
|
|
|
|
|
|
|
sub make_variant { |
26
|
|
|
|
|
|
|
|
27
|
4
|
|
|
4
|
1
|
4442
|
my ( $class, $target, $parent, $role ) = @_; |
28
|
|
|
|
|
|
|
|
29
|
4
|
|
|
|
|
31
|
with $role; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has '+_parent' => ( |
32
|
|
|
|
|
|
|
is => 'lazy', |
33
|
4
|
|
|
|
|
3459
|
handles => [ keys %{ { $parent->_options_data } } ], |
|
4
|
|
|
|
|
151
|
|
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# |
41
|
|
|
|
|
|
|
# This file is part of MooX-Cmd-ChainedOptions |
42
|
|
|
|
|
|
|
# |
43
|
|
|
|
|
|
|
# This software is Copyright (c) 2017 by Smithsonian Astrophysical Observatory. |
44
|
|
|
|
|
|
|
# |
45
|
|
|
|
|
|
|
# This is free software, licensed under: |
46
|
|
|
|
|
|
|
# |
47
|
|
|
|
|
|
|
# The GNU General Public License, Version 3, June 2007 |
48
|
|
|
|
|
|
|
# |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=pod |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 NAME |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
MooX::Cmd::ChainedOptions::Role - generate per-command roles to handle chained options |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 VERSION |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
version 0.04 |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 DESCRIPTION |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
This role factory builds upon L. It |
63
|
|
|
|
|
|
|
creates a role for each command which augments the C<_parent> |
64
|
|
|
|
|
|
|
attribute from the similar role for the next higher command in the |
65
|
|
|
|
|
|
|
command chain to handle the options from that next higher command. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=begin pod-coverage |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=end pod-coverage |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 make_variant |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 build_variant |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
You can make new bug reports, and view existing ones, through the |
81
|
|
|
|
|
|
|
web interface at L. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 SEE ALSO |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Please see those modules/websites for more information related to this module. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=over 4 |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item * |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
L |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=back |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 AUTHOR |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Diab Jerius |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
This software is Copyright (c) 2017 by Smithsonian Astrophysical Observatory. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
This is free software, licensed under: |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
__END__ |