line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
9
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
71
|
|
2
|
3
|
|
|
3
|
|
10
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
80
|
|
3
|
|
|
|
|
|
|
package Net::OAuth2::Scheme::Option::Defines; |
4
|
|
|
|
|
|
|
BEGIN { |
5
|
3
|
|
|
3
|
|
128
|
$Net::OAuth2::Scheme::Option::Defines::VERSION = '0.020002_099'; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
# ABSTRACT: functions for creating option groups and default values |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our (@ISA, @EXPORT, @EXPORT_OK); |
10
|
|
|
|
|
|
|
BEGIN { |
11
|
3
|
|
|
3
|
|
6
|
@EXPORT = qw(Default_Value Define_Group); |
12
|
3
|
|
|
|
|
47
|
@EXPORT_OK = qw(All_Classes); |
13
|
|
|
|
|
|
|
} |
14
|
3
|
|
|
3
|
|
12
|
use parent qw(Exporter); |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
14
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $_marker; # value does not matter |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# _mark(CLASS) |
19
|
|
|
|
|
|
|
# marks the class as containing stuff that we care about |
20
|
|
|
|
|
|
|
sub _mark { |
21
|
28
|
|
|
28
|
|
23
|
my $class = shift; |
22
|
3
|
|
|
3
|
|
194
|
no strict 'refs'; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
205
|
|
23
|
28
|
|
|
|
|
26
|
${"${class}::_Has_Defaults_Or_Groups"} = \ $_marker; |
|
28
|
|
|
|
|
79
|
|
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# _is_marked(CLASS) |
27
|
|
|
|
|
|
|
# does this class contain stuff that we care about |
28
|
|
|
|
|
|
|
sub _is_marked { |
29
|
14
|
|
|
14
|
|
12
|
my $class = shift; |
30
|
3
|
|
|
3
|
|
11
|
no strict 'refs'; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
71
|
|
31
|
3
|
|
|
3
|
|
9
|
no warnings 'uninitialized'; |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
188
|
|
32
|
14
|
|
|
|
|
11
|
return ${"${class}::_Has_Defaults_Or_Groups"} == \ $_marker; |
|
14
|
|
|
|
|
60
|
|
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# All_Classes(CLASS) |
36
|
|
|
|
|
|
|
# return all classes in the ancestor tree of CLASS |
37
|
|
|
|
|
|
|
# that contain stuff that we care about |
38
|
|
|
|
|
|
|
sub All_Classes { |
39
|
14
|
|
|
14
|
1
|
13
|
my $class = shift; |
40
|
3
|
|
|
3
|
|
11
|
no strict 'refs'; |
|
3
|
|
|
|
|
27
|
|
|
3
|
|
|
|
|
254
|
|
41
|
|
|
|
|
|
|
return |
42
|
14
|
100
|
|
|
|
10
|
((map { All_Classes($_) } @{"${class}::ISA"}), |
|
7
|
|
|
|
|
11
|
|
|
14
|
|
|
|
|
33
|
|
43
|
|
|
|
|
|
|
(_is_marked($class) ? ($class) : ())); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub Default_Value { |
47
|
21
|
|
|
21
|
1
|
28
|
my ($oname, $value) = @_; |
48
|
21
|
|
|
|
|
22
|
my $class = caller; |
49
|
21
|
|
|
|
|
34
|
_mark($class); |
50
|
3
|
|
|
3
|
|
9
|
no strict 'refs'; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
252
|
|
51
|
21
|
|
|
|
|
17
|
${"${class}::Default"}{$oname} = $value; |
|
21
|
|
|
|
|
56
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# suppress warning about Default only being used once |
54
|
21
|
|
|
|
|
14
|
${"${class}::Default"}{''} = 0; |
|
21
|
|
|
|
|
50
|
|
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub Define_Group { |
58
|
7
|
|
|
7
|
1
|
23
|
my ($gname, $default, @keys) = @_; |
59
|
7
|
|
|
|
|
14
|
my $class = caller; |
60
|
7
|
|
|
|
|
28
|
_mark($class); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# if no keys given, assume single-option group |
63
|
|
|
|
|
|
|
# with option name as the group name |
64
|
7
|
100
|
|
|
|
23
|
@keys = ($gname) unless @keys; |
65
|
|
|
|
|
|
|
|
66
|
3
|
|
|
3
|
|
12
|
no strict 'refs'; |
|
3
|
|
|
|
|
2
|
|
|
3
|
|
|
|
|
292
|
|
67
|
7
|
100
|
|
|
|
41
|
${"${class}::Group"}{$gname} = |
|
7
|
|
|
|
|
32
|
|
68
|
|
|
|
|
|
|
+{ |
69
|
|
|
|
|
|
|
keys => \@keys, |
70
|
|
|
|
|
|
|
(defined($default) |
71
|
|
|
|
|
|
|
? (default => ["pkg_${gname}_${default}"]) |
72
|
|
|
|
|
|
|
: ()), |
73
|
|
|
|
|
|
|
}; |
74
|
|
|
|
|
|
|
# suppress warning about Group only being used once |
75
|
7
|
|
|
|
|
16
|
${"${class}::Group"}{''} = +{ keys => [] }; |
|
7
|
|
|
|
|
23
|
|
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |