line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Curio::Declare; |
2
|
|
|
|
|
|
|
our $VERSION = '0.09'; |
3
|
|
|
|
|
|
|
|
4
|
10
|
|
|
10
|
|
4174
|
use Package::Stash; |
|
10
|
|
|
|
|
71214
|
|
|
10
|
|
|
|
|
355
|
|
5
|
10
|
|
|
10
|
|
3412
|
use Curio::Util; |
|
10
|
|
|
|
|
38
|
|
|
10
|
|
|
|
|
596
|
|
6
|
|
|
|
|
|
|
|
7
|
10
|
|
|
10
|
|
72
|
use strictures 2; |
|
10
|
|
|
|
|
73
|
|
|
10
|
|
|
|
|
373
|
|
8
|
10
|
|
|
10
|
|
1837
|
use namespace::clean; |
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
54
|
|
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
|
|
6051
|
my $target = caller; |
29
|
|
|
|
|
|
|
|
30
|
36
|
|
|
|
|
267
|
my $stash = Package::Stash->new( $target ); |
31
|
|
|
|
|
|
|
|
32
|
36
|
|
|
|
|
365
|
foreach my $sub_name (sort keys %EXPORTS) { |
33
|
504
|
|
|
|
|
1283
|
my $type = $EXPORTS{ $sub_name }; |
34
|
504
|
|
|
|
|
800
|
my $builder = "_build_$type\_sub"; |
35
|
504
|
|
|
|
|
1504
|
my $sub = __PACKAGE__->can( $builder )->( $target, $sub_name ); |
36
|
504
|
|
|
|
|
1984
|
$sub = subname( $sub_name, $sub ); |
37
|
504
|
|
|
|
|
3183
|
$stash->add_symbol( "&$sub_name", $sub ); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
36
|
|
|
|
|
217
|
return; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub _build_string_sub { |
44
|
144
|
|
|
144
|
|
274
|
my ($target, $sub_name) = @_; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
return sub{ |
47
|
27
|
|
|
27
|
|
5738
|
my $factory = $target->factory(); |
48
|
27
|
|
|
|
|
87
|
@_ = ( $factory, shift ); |
49
|
27
|
|
|
|
|
45
|
goto &{ $factory->can( $sub_name ) }; |
|
27
|
|
|
|
|
733
|
|
50
|
144
|
|
|
|
|
638
|
}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _build_bool_sub { |
54
|
252
|
|
|
252
|
|
454
|
my ($target, $sub_name) = @_; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
return sub{ |
57
|
19
|
|
|
19
|
|
29824
|
my $factory = $target->factory(); |
58
|
19
|
100
|
|
|
|
78
|
@_ = ( $factory, (@_ ? shift : 1 ) ); |
59
|
19
|
|
|
|
|
41
|
goto &{ $factory->can( $sub_name ) }; |
|
19
|
|
|
|
|
514
|
|
60
|
252
|
|
|
|
|
921
|
}; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub _build_hashref_sub { |
64
|
36
|
|
|
36
|
|
83
|
my ($target, $sub_name) = @_; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
return sub{ |
67
|
1
|
|
|
1
|
|
2724
|
my $factory = $target->factory(); |
68
|
1
|
|
|
|
|
5
|
@_ = ( $factory, {@_} ); |
69
|
1
|
|
|
|
|
2
|
goto &{ $factory->can( $sub_name ) }; |
|
1
|
|
|
|
|
29
|
|
70
|
36
|
|
|
|
|
117
|
}; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub _build_method_sub { |
74
|
72
|
|
|
72
|
|
161
|
my ($target, $sub_name) = @_; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
return sub{ |
77
|
27
|
|
|
27
|
|
58788
|
my $factory = $target->factory(); |
78
|
27
|
|
|
|
|
93
|
@_ = ( $factory, @_ ); |
79
|
27
|
|
|
|
|
55
|
goto &{ $factory->can( $sub_name ) }; |
|
27
|
|
|
|
|
202
|
|
80
|
72
|
|
|
|
|
308
|
}; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
84
|
|
|
|
|
|
|
__END__ |