ExtDirect/Util/Accessor.pm

filter: Statementstmt 64.7% 410 / 633 Branchbran 77.6% 163 / 210 Conditioncond 75.0% 9 / 12 MC/DCmcdc 37.5% 3 / 8 Subroutinesub 62.1% 110 / 177 Podpod 46.5% 75 / 161 totaltotal 64.1% 770 / 1201 CC 158 SCAR 7.2
CC
158
Cov
68%
_create_accessor
10.4
mk_accessors
10.1
bar_baz
3.4
CRAP 2.1
« ExtDirect/Test/Pkg/PollProvider.pm ↑ Summary ExtDirect/Router.pm »
1 package RPC::ExtDirect::Util::Accessor;
2  
3 160 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 98 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 108 ▶no warnings 'uninitialized'; ## no critic
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 108 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 ### NON-EXPORTED PUBLIC PACKAGE SUBROUTINE ###
10 #
11 # Generate either simple accessors, or complex ones, or both
12 #
13  
14 238 ▶sub mk_accessors {
Subroutine mk_accessors: called CC=10 SCAR=23.1
Pod undocumented
15 # Support class method calling convention for convenience
16 238 ▶ shift if $_[0] eq __PACKAGE__;
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] eq __PACKAGE__ 3 267 270
17
18 238 my (%arg) = @_;
19
20 238 ▶ $arg{class} ||= caller();
Condition66%2/3
$arg{"class"} ||= caller()
l!l&&r!l&&!r
42040
MC/DC0%0/2
$arg{"class"} ||= caller()
$arg{"class"} caller()
Truth table66%2/3
A ||= B
A= $arg{"class"}B= caller()
ABresult
1X1
011
000
21
22 238 my $simplexes = $arg{simple};
23
24 238 ▶ $simplexes = [ $simplexes ] unless 'ARRAY' eq ref $simplexes;
Branch: 1 branch
BranchTrueFalseTotal
unless "ARRAY" eq ref $simplexes 3 233 236
25
26 238 for my $accessor ( @$simplexes ) {
27 2058 ▶ next unless defined $accessor;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $accessor 1 2027 2028
28  
29 2057 _create_accessor(
30 type => 'simple',
31 accessor => $accessor,
32 %arg,
33 );
34 }
35
36 237 my $complexes = $arg{complex};
37
38 237 for my $prop ( @$complexes ) {
39 513 ▶ my $setters = $prop->{setter} || $prop->{accessor};
Condition66%2/3
$prop->{'setter'} || $prop->{'accessor'}
l!l&&r!l&&!r
48210
MC/DC0%0/2
$prop->{'setter'} || $prop->{'accessor'}
$prop->{'setter'} $prop->{'accessor'}
Truth table66%2/3
A || B
A= $prop->{'setter'}B= $prop->{'accessor'}
ABresult
1X1
011
000
40
41 513 ▶ $setters = [ $setters ] unless 'ARRAY' eq ref $setters;
Branch: 1 branch
BranchTrueFalseTotal
unless "ARRAY" eq ref $setters 483 0 483
42
43 513 for my $specific ( @$setters ) {
44 _create_accessor(
45 type => 'complex',
46 accessor => $specific,
47 fallback => $prop->{fallback},
48 513 %arg,
49 );
50 }
51 }
52 }
53  
54 # This is a convenience shortcut, too, as I always forget if
55 # the sub name is singular or plural...
56 81 *mk_accessor = *mk_accessors;
57  
58 ############## PRIVATE METHODS BELOW ##############
59  
60 ### PRIVATE PACKAGE SUBROUTINE ###
61 #
62 # Create an accessor
63 #
64  
65 2540 ▶sub _create_accessor {
Subroutine _create_accessor: called CC=8 SCAR=23.4
66 2540 my (%arg) = @_;
67
68 2540 my $class = $arg{class};
69 2540 my $overwrite = $arg{overwrite};
70 2540 my $ignore = $arg{ignore};
71 2540 my $type = $arg{type};
72 2540 my $accessor = $arg{accessor};
73 2540 my $fallback = $arg{fallback};
74  
75 2540 ▶ return unless defined $accessor;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $accessor 0 2510 2510
76  
77 2540 ▶ if ( $class->can($accessor) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($class->can($accessor)) 3 2507 2510
78 33 ▶ croak "Accessor $accessor already exists in class $class"
Branch: 1 branch
BranchTrueFalseTotal
unless $overwrite or $ignore 1 2 3
Condition100%3/3
$overwrite or $ignore
l!l&&r!l&&!r
111
MC/DC100%2/2
$overwrite or $ignore
$overwrite $ignore
Truth table100%3/3
A or B
A= $overwriteB= $ignore
ABresult
1X1
011
000
79 if !$overwrite && !$ignore;
80
81 32 ▶ return if $ignore && !$overwrite;
Branch: 1 branch
BranchTrueFalseTotal
if $ignore and not $overwrite 1 1 2
Condition66%2/3
$ignore and not $overwrite
!ll&&!rl&&r
101
MC/DC50%1/2
$ignore and not $overwrite
$ignore not $overwrite
Truth table66%2/3
A and not(B)
A= $ignoreB= not $overwrite
ABresult
0X0
100
111
82 }
83
84 2538 ▶ my $accessor_fn = $type eq 'complex' ? _complex($accessor, $fallback)
Branch: 1 branch
BranchTrueFalseTotal
$type eq 'complex' ? : 483 2025 2508
85 : _simplex($accessor)
86 ;
87 2538 my $predicate_fn = _predicate($accessor);
88
89 0 ▶ eval "package $class; no warnings 'redefine'; " .
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine array_value: called CC=2 SCAR=7.7
Subroutine bar: called CC=2 SCAR=7.7
Subroutine bar_baz: called CC=3 SCAR=12.1
Subroutine baz: called CC=2 SCAR=7.7
Subroutine baz_baz: called CC=3 SCAR=12.1
Subroutine empty_array: called CC=2 SCAR=7.7
Subroutine empty_hash: called CC=2 SCAR=7.7
Subroutine empty_scalar: called CC=2 SCAR=7.7
Subroutine fred: called CC=2 SCAR=7.7
Subroutine has_array_value: called CC=1 SCAR=0.4
Subroutine has_bar: called CC=1 SCAR=0.4
Subroutine has_bar_baz: called CC=1 SCAR=0.4
Subroutine has_baz: called CC=1 SCAR=0.4
Subroutine has_baz_baz: called CC=1 SCAR=0.4
Subroutine has_empty_array: called CC=1 SCAR=0.4
Subroutine has_empty_hash: called CC=1 SCAR=0.4
Subroutine has_empty_scalar: called CC=1 SCAR=0.4
Subroutine has_fred: called CC=1 SCAR=0.4
Subroutine has_hash_value: called CC=1 SCAR=0.4
Subroutine has_scalar_value: called CC=1 SCAR=0.4
Subroutine hash_value: called CC=2 SCAR=7.7
Subroutine scalar_value: called CC=2 SCAR=7.7
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine BEGIN: not called CC=1 SCAR=0.4
Subroutine action: not called CC=2 SCAR=7.7
Subroutine after: not called CC=2 SCAR=7.7
Subroutine after: not called CC=2 SCAR=7.7
Subroutine after: not called CC=2 SCAR=7.7
Subroutine api: not called CC=2 SCAR=7.7
Subroutine api_action_class: not called CC=2 SCAR=7.7
Subroutine api_full_action_names: not called CC=2 SCAR=7.7
Subroutine api_hook_class: not called CC=2 SCAR=7.7
Subroutine api_method_class: not called CC=2 SCAR=7.7
Subroutine api_path: not called CC=2 SCAR=7.7
Subroutine argument_checker: not called CC=2 SCAR=7.7
Subroutine argument_preparer: not called CC=2 SCAR=7.7
Subroutine auto_connect: not called CC=2 SCAR=7.7
Subroutine before: not called CC=2 SCAR=7.7
Subroutine before: not called CC=2 SCAR=7.7
Subroutine before: not called CC=2 SCAR=7.7
Subroutine code: not called CC=2 SCAR=7.7
Subroutine config: not called CC=2 SCAR=7.7
Subroutine config: not called CC=2 SCAR=7.7
Subroutine config: not called CC=2 SCAR=7.7
Subroutine config: not called CC=2 SCAR=7.7
Subroutine debug: not called CC=2 SCAR=7.7
Subroutine debug_api: not called CC=3 SCAR=12.1
Subroutine debug_deserialize: not called CC=3 SCAR=12.1
Subroutine debug_eventprovider: called CC=3 SCAR=12.1
Subroutine debug_request: called CC=3 SCAR=12.1
Subroutine debug_router: called CC=3 SCAR=12.1
Subroutine debug_serialize: called CC=3 SCAR=12.1
Subroutine decode_params: called CC=2 SCAR=7.7
Subroutine deserializer_class: called CC=2 SCAR=7.7
Subroutine deserializer_class_router: called CC=3 SCAR=12.1
Subroutine env_arg: called CC=2 SCAR=7.7
Subroutine eventprovider_class: called CC=2 SCAR=7.7
Subroutine exception_class: called CC=2 SCAR=7.7
Subroutine exception_class_deserialize: not called CC=3 SCAR=12.1
Subroutine exception_class_request: called CC=3 SCAR=12.1
Subroutine exception_class_serialize: called CC=3 SCAR=12.1
Subroutine formHandler: called CC=2 SCAR=7.7
Subroutine has_action: called CC=1 SCAR=0.4
Subroutine has_after: called CC=1 SCAR=0.4
Subroutine has_after: called CC=1 SCAR=0.4
Subroutine has_after: called CC=1 SCAR=0.4
Subroutine has_api: called CC=1 SCAR=0.4
Subroutine has_api_action_class: called CC=1 SCAR=0.4
Subroutine has_api_full_action_names: called CC=1 SCAR=0.4
Subroutine has_api_hook_class: called CC=1 SCAR=0.4
Subroutine has_api_method_class: called CC=1 SCAR=0.4
Subroutine has_api_path: called CC=1 SCAR=0.4
Subroutine has_argument_checker: called CC=1 SCAR=0.4
Subroutine has_argument_preparer: called CC=1 SCAR=0.4
Subroutine has_auto_connect: called CC=1 SCAR=0.4
Subroutine has_before: called CC=1 SCAR=0.4
Subroutine has_before: called CC=1 SCAR=0.4
Subroutine has_before: called CC=1 SCAR=0.4
Subroutine has_code: called CC=1 SCAR=0.4
Subroutine has_config: called CC=1 SCAR=0.4
Subroutine has_config: called CC=1 SCAR=0.4
Subroutine has_config: called CC=1 SCAR=0.4
Subroutine has_config: called CC=1 SCAR=0.4
Subroutine has_debug: called CC=1 SCAR=0.4
Subroutine has_debug_api: called CC=1 SCAR=0.4
Subroutine has_debug_deserialize: called CC=1 SCAR=0.4
Subroutine has_debug_eventprovider: called CC=1 SCAR=0.4
Subroutine has_debug_request: called CC=1 SCAR=0.4
Subroutine has_debug_router: called CC=1 SCAR=0.4
Subroutine has_debug_serialize: called CC=1 SCAR=0.4
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod undocumented
Pod undocumented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod undocumented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod undocumented
Pod documented
Pod documented
Pod undocumented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Pod documented
Branch: 96 branches
BranchTrueFalseTotal
if (@_) { } 1 170 171
if (@_) { } 7 105 112
if (@_) { } 22 147 169
exists $self->{'bar_baz'} ? : 6 196 202
if (@_) { } 18 166 184
if (@_) { } 162 345 507
exists $self->{'baz_baz'} ? : 162 223 385
if (@_) { } 163 758 921
if (@_) { } 165 529 694
if (@_) { } 163 164 327
if (@_) { } 1 83 84
if (@_) { } 1 134 135
if (@_) { } 170 173 343
if (@_) { } 8 164 172
if (@_) { } 25 184 209
if (@_) { } 6 244 250
if (@_) { } 19 359 378
if (@_) { } 0 148 148
if (@_) { } 0 208 208
if (@_) { } 0 319 319
if (@_) { } 0 121 121
if (@_) { } 164 421 585
if (@_) { } 4 21 25
if (@_) { } 4 8 12
if (@_) { } 8 6 14
if (@_) { } 2 4 6
if (@_) { } 0 11 11
if (@_) { } 0 11 11
if (@_) { } 29 41 70
if (@_) { } 31 10 41
if (@_) { } 23 61 84
if (@_) { } 46 15 61
if (@_) { } 14 12 26
if (@_) { } 0 12 12
if (@_) { } 0 20 20
if (@_) { } 162 195 357
exists $self->{'debug_api'} ? : 0 31 31
if (@_) { } 0 31 31
exists $self->{'debug_deserialize'} ? : 0 133 133
if (@_) { } 162 163 325
exists $self->{'debug_eventprovider'} ? : 165 192 357
if (@_) { } 1 6 7
exists $self->{'debug_request'} ? : 1 5 6
if (@_) { } 0 16 16
exists $self->{'debug_router'} ? : 0 16 16
if (@_) { } 1 6 7
exists $self->{'debug_serialize'} ? : 1 5 6
if (@_) { } 2 277 279
if (@_) { } 2 114 116
if (@_) { } 1 100 101
exists $self->{'deserializer_class_router'} ? : 0 170 170
if (@_) { } 0 84 84
if (@_) { } 0 228 228
if (@_) { } 1 94 95
if (@_) { } 0 29 29
exists $self->{'exception_class_deserialize'} ? : 0 29 29
if (@_) { } 0 62 62
exists $self->{'exception_class_request'} ? : 0 62 62
if (@_) { } 0 264 264
exists $self->{'exception_class_serialize'} ? : 1 10 11
if (@_) { } 0 0 0
if (@_) { } 0 487 487
if (@_) { } 0 149 149
if (@_) { } 0 63 63
if (@_) { } 0 580 580
if (@_) { } 0 832 832
if (@_) { } 8 44 52
if (@_) { } 163 171 334
exists $self->{'json_options_deserialize'} ? : 0 889 889
if (@_) { } 0 222 222
exists $self->{'json_options_serialize'} ? : 0 293 293
if (@_) { } 0 146 146
if (@_) { } 0 700 700
if (@_) { } 170 168 338
if (@_) { } 169 171 340
if (@_) { } 170 171 341
if (@_) { } 163 207 370
if (@_) { } 0 43 43
if (@_) { } 0 43 43
if (@_) { } 162 172 334
if (@_) { } 162 163 325
if (@_) { } 170 171 341
if (@_) { } 60 114 174
if (@_) { } 162 217 379
if (@_) { } 0 9 9
if (@_) { } 0 9 9
if (@_) { } 0 11 11
if (@_) { } 0 11 11
if (@_) { } 0 31 31
if (@_) { } 0 31 31
if (@_) { } 0 66 66
exists $self->{'request_class_deserialize'} ? : 0 55 55
if (@_) { } 1 10 11
if (@_) { } 0 41 41
if (@_) { } 0 41 41
if (@_) { } 163 248 411
90 "$accessor_fn; $predicate_fn; 1";
91 }
92  
93 ### PRIVATE PACKAGE SUBROUTINE ###
94 #
95 # Return the text for a predicate method
96 #
97  
98 2560 ▶sub _predicate {
Subroutine _predicate: called CC=1 SCAR=0.0
99 2541 my ($prop) = @_;
100
101 2541 return "
102 sub has_$prop {
103 my \$self = shift;
104
105 return exists \$self->{$prop};
106 }
107 ";
108 }
109  
110 ### PRIVATE PACKAGE SUBROUTINE ###
111 #
112 # Return the text for a simple accessor method that acts as both getter
113 # when there are no arguments passed to it, and as a setter when there is
114 # at least one argument.
115 # When used as a setter, only the first argument will be assigned
116 # to the object property, the rest will be ignored.
117 #
118  
119 2067 ▶sub _simplex {
Subroutine _simplex: called CC=1 SCAR=0.0
120 2245 my ($prop) = @_;
121
122 2398 return "
123 sub $prop {
124 my \$self = shift;
125
126 if ( \@_ ) {
127 \$self->{$prop} = shift;
128 return \$self;
129 }
130 else {
131 return \$self->{$prop};
132 }
133 }
134 ";
135 }
136  
137 ### PRIVATE PACKAGE SUBROUTINE ###
138 #
139 # Return an accessor that will query the 'specific' object property
140 # first and return it if it's defined, falling back to the 'fallback'
141 # property getter otherwise when called with no arguments.
142 # Setter will set the 'specific' property for the object when called
143 # with one argument.
144 #
145  
146 521 ▶sub _complex {
Subroutine _complex: called CC=1 SCAR=0.0
147 856 my ($specific, $fallback) = @_;
148
149 529 return "
150 sub $specific {
151 my \$self = shift;
152
153 if ( \@_ ) {
154 \$self->{$specific} = shift;
155 return \$self;
156 }
157 else {
158 return exists \$self->{$specific}
159 ? \$self->{$specific}
160 : \$self->$fallback()
161 ;
162 }
163 }
164 ";
165 }
166  
167 389 1;
« ExtDirect/Test/Pkg/PollProvider.pm ↑ Summary ExtDirect/Router.pm »