line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Curio::Declare; |
2
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
3
|
|
|
|
|
|
|
|
4
|
10
|
|
|
10
|
|
4155
|
use Package::Stash; |
|
10
|
|
|
|
|
73055
|
|
|
10
|
|
|
|
|
355
|
|
5
|
10
|
|
|
10
|
|
3615
|
use Curio::Util; |
|
10
|
|
|
|
|
37
|
|
|
10
|
|
|
|
|
613
|
|
6
|
|
|
|
|
|
|
|
7
|
10
|
|
|
10
|
|
68
|
use strictures 2; |
|
10
|
|
|
|
|
67
|
|
|
10
|
|
|
|
|
372
|
|
8
|
10
|
|
|
10
|
|
1783
|
use namespace::clean; |
|
10
|
|
|
|
|
23
|
|
|
10
|
|
|
|
|
51
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my %EXPORTS = ( |
11
|
|
|
|
|
|
|
does_registry => 'bool', |
12
|
|
|
|
|
|
|
resource_method_name => 'string', |
13
|
|
|
|
|
|
|
installs_curio_method => 'bool', |
14
|
|
|
|
|
|
|
does_caching => 'bool', |
15
|
|
|
|
|
|
|
cache_per_process => 'bool', |
16
|
|
|
|
|
|
|
export_function_name => 'string', |
17
|
|
|
|
|
|
|
always_export => 'bool', |
18
|
|
|
|
|
|
|
export_resource => 'bool', |
19
|
|
|
|
|
|
|
allow_undeclared_keys => 'bool', |
20
|
|
|
|
|
|
|
default_key => 'string', |
21
|
|
|
|
|
|
|
key_argument => 'string', |
22
|
|
|
|
|
|
|
default_arguments => 'hashref', |
23
|
|
|
|
|
|
|
add_key => 'method', |
24
|
|
|
|
|
|
|
alias_key => 'method', |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub import { |
28
|
36
|
|
|
36
|
|
6340
|
my $target = caller; |
29
|
|
|
|
|
|
|
|
30
|
36
|
|
|
|
|
273
|
my $stash = Package::Stash->new( $target ); |
31
|
|
|
|
|
|
|
|
32
|
36
|
|
|
|
|
368
|
foreach my $sub_name (sort keys %EXPORTS) { |
33
|
504
|
|
|
|
|
919
|
my $type = $EXPORTS{ $sub_name }; |
34
|
504
|
|
|
|
|
778
|
my $builder = "_build_$type\_sub"; |
35
|
504
|
|
|
|
|
1461
|
my $sub = __PACKAGE__->can( $builder )->( $target, $sub_name ); |
36
|
504
|
|
|
|
|
1969
|
$sub = subname( $sub_name, $sub ); |
37
|
504
|
|
|
|
|
3168
|
$stash->add_symbol( "&$sub_name", $sub ); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
36
|
|
|
|
|
270
|
return; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub _build_string_sub { |
44
|
144
|
|
|
144
|
|
264
|
my ($target, $sub_name) = @_; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
return sub{ |
47
|
27
|
|
|
27
|
|
4729
|
my $factory = $target->factory(); |
48
|
27
|
|
|
|
|
73
|
@_ = ( $factory, shift ); |
49
|
27
|
|
|
|
|
45
|
goto &{ $factory->can( $sub_name ) }; |
|
27
|
|
|
|
|
663
|
|
50
|
144
|
|
|
|
|
724
|
}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _build_bool_sub { |
54
|
252
|
|
|
252
|
|
458
|
my ($target, $sub_name) = @_; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
return sub{ |
57
|
18
|
|
|
18
|
|
27653
|
my $factory = $target->factory(); |
58
|
18
|
100
|
|
|
|
71
|
@_ = ( $factory, (@_ ? shift : 1 ) ); |
59
|
18
|
|
|
|
|
32
|
goto &{ $factory->can( $sub_name ) }; |
|
18
|
|
|
|
|
461
|
|
60
|
252
|
|
|
|
|
982
|
}; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub _build_hashref_sub { |
64
|
36
|
|
|
36
|
|
81
|
my ($target, $sub_name) = @_; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
return sub{ |
67
|
1
|
|
|
1
|
|
2232
|
my $factory = $target->factory(); |
68
|
1
|
|
|
|
|
5
|
@_ = ( $factory, {@_} ); |
69
|
1
|
|
|
|
|
3
|
goto &{ $factory->can( $sub_name ) }; |
|
1
|
|
|
|
|
30
|
|
70
|
36
|
|
|
|
|
116
|
}; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub _build_method_sub { |
74
|
72
|
|
|
72
|
|
176
|
my ($target, $sub_name) = @_; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
return sub{ |
77
|
29
|
|
|
29
|
|
56526
|
my $factory = $target->factory(); |
78
|
29
|
|
|
|
|
94
|
@_ = ( $factory, @_ ); |
79
|
29
|
|
|
|
|
50
|
goto &{ $factory->can( $sub_name ) }; |
|
29
|
|
|
|
|
268
|
|
80
|
72
|
|
|
|
|
288
|
}; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
84
|
|
|
|
|
|
|
__END__ |