line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Constructor::SugarLibrary; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
121194
|
use strictures 2; |
|
3
|
|
|
|
|
27
|
|
|
3
|
|
|
|
|
127
|
|
4
|
3
|
|
|
3
|
|
1141
|
use Import::Into; |
|
3
|
|
|
|
|
535
|
|
|
3
|
|
|
|
|
80
|
|
5
|
3
|
|
|
3
|
|
1283
|
use Constructor::Sugar (); |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
76
|
|
6
|
3
|
|
|
3
|
|
21
|
use Throwable::SugarFactory::Utils '_getglob'; |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
189
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.213360'; # VERSION |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: build a library of generic constructor syntax sugar |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
# This file is part of Throwable-SugarFactory |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
# Christian Walde has dedicated the work to the Commons by waiving all of his |
17
|
|
|
|
|
|
|
# or her rights to the work worldwide under copyright law and all related or |
18
|
|
|
|
|
|
|
# neighboring legal rights he or she had in the work, to the extent allowable by |
19
|
|
|
|
|
|
|
# law. |
20
|
|
|
|
|
|
|
# |
21
|
|
|
|
|
|
|
# Works under CC0 do not require attribution. When citing the work, you should |
22
|
|
|
|
|
|
|
# not imply endorsement by the author. |
23
|
|
|
|
|
|
|
# |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
{ |
27
|
|
|
|
|
|
|
## no critic (ProhibitNoStrict) |
28
|
3
|
|
|
3
|
|
18
|
no strict 'refs'; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
1335
|
|
29
|
9
|
|
|
9
|
|
12
|
sub _getexport { \@{"$_[0]::EXPORT"} } |
|
9
|
|
|
|
|
37
|
|
30
|
9
|
|
|
9
|
|
17
|
sub _getexport_tags { \%{"$_[0]::EXPORT_TAGS"} } |
|
9
|
|
|
|
|
34
|
|
31
|
|
|
|
|
|
|
## use critic |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub import { |
35
|
3
|
|
|
3
|
|
517
|
base->import::into( scalar caller, "Exporter" ); # I::I 1.001000 syntax |
36
|
3
|
|
|
|
|
850
|
my $library = caller; |
37
|
|
|
|
|
|
|
my $sweeten_func = sub { |
38
|
10
|
|
|
10
|
|
104
|
for my $spec ( @_ ) { |
39
|
10
|
|
|
|
|
42
|
my ( $class ) = split /->/, $spec; |
40
|
10
|
|
|
|
|
39
|
my ( $id ) = ( reverse split /::/, $class )[0]; |
41
|
10
|
|
|
|
|
53
|
my ( $ctors, $ids ) = |
42
|
|
|
|
|
|
|
Constructor::Sugar->import::into( $library, $spec ); |
43
|
9
|
|
|
|
|
20
|
push @{ _getexport $library}, @{$ctors}, @{$ids}; |
|
9
|
|
|
|
|
27
|
|
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
21
|
|
44
|
9
|
|
|
|
|
22
|
my $tags = _getexport_tags $library; |
45
|
9
|
|
|
|
|
18
|
push @{ $tags->{$id} }, @{$ctors}, @{$ids}; |
|
9
|
|
|
|
|
24
|
|
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
19
|
|
46
|
9
|
|
|
|
|
14
|
push @{ $tags->{ctors} }, @{$ctors}; |
|
9
|
|
|
|
|
33
|
|
|
9
|
|
|
|
|
18
|
|
47
|
9
|
|
|
|
|
16
|
push @{ $tags->{ids} }, @{$ids}; |
|
9
|
|
|
|
|
28
|
|
|
9
|
|
|
|
|
40
|
|
48
|
|
|
|
|
|
|
} |
49
|
3
|
|
|
|
|
18
|
}; |
50
|
|
|
|
|
|
|
my $sweeten_meth = sub { |
51
|
7
|
|
|
7
|
|
13
|
shift; |
52
|
7
|
|
|
|
|
24
|
$sweeten_func->( @_ ); |
53
|
3
|
|
|
|
|
9
|
}; |
54
|
3
|
|
|
|
|
7
|
*{ _getglob $library, "sweeten" } = $sweeten_func; |
|
3
|
|
|
|
|
14
|
|
55
|
3
|
|
|
|
|
7
|
*{ _getglob $library, "sweeten_meth" } = $sweeten_meth; |
|
3
|
|
|
|
|
10
|
|
56
|
3
|
|
|
|
|
83
|
return; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |