line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Getopt::ArgParse::Namespace; |
2
|
|
|
|
|
|
|
|
3
|
20
|
|
|
20
|
|
90
|
use Carp; |
|
20
|
|
|
|
|
31
|
|
|
20
|
|
|
|
|
1187
|
|
4
|
20
|
|
|
20
|
|
91
|
use strict; |
|
20
|
|
|
|
|
20
|
|
|
20
|
|
|
|
|
638
|
|
5
|
20
|
|
|
20
|
|
82
|
use warnings; |
|
20
|
|
|
|
|
22
|
|
|
20
|
|
|
|
|
6269
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
33
|
|
|
33
|
0
|
461
|
my $class = shift; |
9
|
33
|
|
33
|
|
|
184
|
my $real_class = ref $class || $class; |
10
|
|
|
|
|
|
|
|
11
|
33
|
|
|
|
|
79
|
my $self = {}; |
12
|
|
|
|
|
|
|
|
13
|
33
|
|
|
|
|
787
|
bless $self, $real_class; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub set_attr { |
17
|
472
|
|
|
472
|
0
|
1234
|
my $self = shift; |
18
|
472
|
|
|
|
|
521
|
my ($dest, $values) = @_; |
19
|
|
|
|
|
|
|
|
20
|
472
|
|
|
|
|
998
|
$self->{'-values'}{$dest} = $values; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub get_attr { |
24
|
799
|
|
|
799
|
0
|
2780
|
my $self = shift; |
25
|
799
|
|
|
|
|
781
|
my ($dest) = @_; |
26
|
|
|
|
|
|
|
|
27
|
799
|
50
|
|
|
|
1160
|
confess "Must provide $dest" unless $dest; |
28
|
|
|
|
|
|
|
|
29
|
799
|
100
|
|
|
|
2591
|
return $self->{'-values'}{$dest} if exists $self->{'-values'}{$dest}; |
30
|
|
|
|
|
|
|
|
31
|
204
|
|
|
|
|
2319
|
return undef; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
our $AUTOLOAD; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub AUTOLOAD { |
37
|
75
|
|
|
75
|
|
4851
|
my $sub = $AUTOLOAD; |
38
|
|
|
|
|
|
|
|
39
|
75
|
|
|
|
|
343
|
(my $dest = $sub) =~ s/.*:://; |
40
|
|
|
|
|
|
|
|
41
|
75
|
|
|
|
|
94
|
my $self = shift; |
42
|
|
|
|
|
|
|
|
43
|
75
|
100
|
|
|
|
206
|
if ( exists $self->{'-values'}{$dest} ) { |
44
|
74
|
|
|
|
|
103
|
my $values = $self->{'-values'}{$dest}; |
45
|
74
|
100
|
|
|
|
193
|
if (ref($values) eq 'ARRAY') { |
|
|
100
|
|
|
|
|
|
46
|
14
|
100
|
|
|
|
77
|
return wantarray ? @$values : $values; |
47
|
|
|
|
|
|
|
} elsif (ref($values) eq 'HASH') { |
48
|
8
|
50
|
|
|
|
33
|
return wantarray ? %$values : $values; |
49
|
|
|
|
|
|
|
} else { |
50
|
52
|
|
|
|
|
258
|
return $values; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} else { |
53
|
1
|
|
|
|
|
210
|
croak "unknown option: $dest"; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
0
|
|
|
sub DESTROY { } |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 AUTHOR |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Mytram (original author) |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
This software is Copyright (c) 2014 by Mytram. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
This is free software, licensed under: |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |