line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Curio::Declare; |
2
|
|
|
|
|
|
|
our $VERSION = '0.11'; |
3
|
|
|
|
|
|
|
|
4
|
10
|
|
|
10
|
|
3600
|
use Package::Stash; |
|
10
|
|
|
|
|
63392
|
|
|
10
|
|
|
|
|
293
|
|
5
|
10
|
|
|
10
|
|
3015
|
use Curio::Util; |
|
10
|
|
|
|
|
30
|
|
|
10
|
|
|
|
|
547
|
|
6
|
|
|
|
|
|
|
|
7
|
10
|
|
|
10
|
|
60
|
use strictures 2; |
|
10
|
|
|
|
|
66
|
|
|
10
|
|
|
|
|
328
|
|
8
|
10
|
|
|
10
|
|
1640
|
use namespace::clean; |
|
10
|
|
|
|
|
15
|
|
|
10
|
|
|
|
|
50
|
|
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
|
|
5288
|
my $target = caller; |
29
|
|
|
|
|
|
|
|
30
|
36
|
|
|
|
|
237
|
my $stash = Package::Stash->new( $target ); |
31
|
|
|
|
|
|
|
|
32
|
36
|
|
|
|
|
322
|
foreach my $sub_name (sort keys %EXPORTS) { |
33
|
504
|
|
|
|
|
845
|
my $type = $EXPORTS{ $sub_name }; |
34
|
504
|
|
|
|
|
698
|
my $builder = "_build_$type\_sub"; |
35
|
504
|
|
|
|
|
1250
|
my $sub = __PACKAGE__->can( $builder )->( $target, $sub_name ); |
36
|
504
|
|
|
|
|
1876
|
$sub = subname( $sub_name, $sub ); |
37
|
504
|
|
|
|
|
2921
|
$stash->add_symbol( "&$sub_name", $sub ); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
36
|
|
|
|
|
190
|
return; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub _build_string_sub { |
44
|
144
|
|
|
144
|
|
241
|
my ($target, $sub_name) = @_; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
return sub{ |
47
|
27
|
|
|
27
|
|
4450
|
my $factory = $target->factory(); |
48
|
27
|
|
|
|
|
71
|
@_ = ( $factory, shift ); |
49
|
27
|
|
|
|
|
40
|
goto &{ $factory->can( $sub_name ) }; |
|
27
|
|
|
|
|
615
|
|
50
|
144
|
|
|
|
|
521
|
}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _build_bool_sub { |
54
|
252
|
|
|
252
|
|
407
|
my ($target, $sub_name) = @_; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
return sub{ |
57
|
18
|
|
|
18
|
|
25004
|
my $factory = $target->factory(); |
58
|
18
|
100
|
|
|
|
68
|
@_ = ( $factory, (@_ ? shift : 1 ) ); |
59
|
18
|
|
|
|
|
29
|
goto &{ $factory->can( $sub_name ) }; |
|
18
|
|
|
|
|
415
|
|
60
|
252
|
|
|
|
|
824
|
}; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub _build_hashref_sub { |
64
|
36
|
|
|
36
|
|
73
|
my ($target, $sub_name) = @_; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
return sub{ |
67
|
1
|
|
|
1
|
|
2103
|
my $factory = $target->factory(); |
68
|
1
|
|
|
|
|
3
|
@_ = ( $factory, {@_} ); |
69
|
1
|
|
|
|
|
2
|
goto &{ $factory->can( $sub_name ) }; |
|
1
|
|
|
|
|
26
|
|
70
|
36
|
|
|
|
|
130
|
}; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub _build_method_sub { |
74
|
72
|
|
|
72
|
|
144
|
my ($target, $sub_name) = @_; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
return sub{ |
77
|
29
|
|
|
29
|
|
50758
|
my $factory = $target->factory(); |
78
|
29
|
|
|
|
|
142
|
@_ = ( $factory, @_ ); |
79
|
29
|
|
|
|
|
46
|
goto &{ $factory->can( $sub_name ) }; |
|
29
|
|
|
|
|
209
|
|
80
|
72
|
|
|
|
|
244
|
}; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
84
|
|
|
|
|
|
|
__END__ |