| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package MooX::SugarFactory; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
28680
|
use strictures 2; |
|
|
2
|
|
|
|
|
15
|
|
|
|
2
|
|
|
|
|
108
|
|
|
4
|
2
|
|
|
2
|
|
1431
|
use Import::Into; |
|
|
2
|
|
|
|
|
3355
|
|
|
|
2
|
|
|
|
|
56
|
|
|
5
|
2
|
|
|
2
|
|
1272
|
use MooX::BuildClass; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
11
|
|
|
6
|
2
|
|
|
2
|
|
987
|
use MooX::BuildRole; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
12
|
|
|
7
|
2
|
|
|
2
|
|
1178
|
use Constructor::SugarLibrary (); |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
46
|
|
|
8
|
2
|
|
|
2
|
|
11
|
use Throwable::SugarFactory::Utils '_getglob'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
614
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.152700'; # VERSION |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# ABSTRACT: build a library of syntax-sugared Moo classes |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# |
|
15
|
|
|
|
|
|
|
# This file is part of Throwable-SugarFactory |
|
16
|
|
|
|
|
|
|
# |
|
17
|
|
|
|
|
|
|
# |
|
18
|
|
|
|
|
|
|
# Christian Walde has dedicated the work to the Commons by waiving all of his |
|
19
|
|
|
|
|
|
|
# or her rights to the work worldwide under copyright law and all related or |
|
20
|
|
|
|
|
|
|
# neighboring legal rights he or she had in the work, to the extent allowable by |
|
21
|
|
|
|
|
|
|
# law. |
|
22
|
|
|
|
|
|
|
# |
|
23
|
|
|
|
|
|
|
# Works under CC0 do not require attribution. When citing the work, you should |
|
24
|
|
|
|
|
|
|
# not imply endorsement by the author. |
|
25
|
|
|
|
|
|
|
# |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub import { |
|
29
|
2
|
|
|
2
|
|
187
|
my ( $class ) = @_; |
|
30
|
2
|
|
|
|
|
17
|
Constructor::SugarLibrary->import::into( scalar caller ); # I::I 1.001000 |
|
31
|
2
|
|
|
|
|
16
|
my $factory = caller; |
|
32
|
4
|
|
|
|
|
11
|
*{ _getglob $factory, $_ } = $class->_creator_with( $factory, $_ ) |
|
33
|
2
|
|
|
|
|
9
|
for qw( class role ); |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub _creator_with { |
|
37
|
4
|
|
|
4
|
|
8
|
my ( $class, $factory, $type ) = @_; |
|
38
|
4
|
|
|
|
|
5
|
my $create = \&{ "Build" . ucfirst $type }; |
|
|
4
|
|
|
|
|
16
|
|
|
39
|
|
|
|
|
|
|
sub { |
|
40
|
7
|
|
|
7
|
|
30
|
my ( $spec, @args ) = @_; |
|
41
|
7
|
|
|
|
|
24
|
my ( $class ) = split /->/, $spec; |
|
42
|
7
|
|
50
|
7
|
|
76
|
my $build = $factory->can( "BUILDARGS" ) || sub { shift; @_ }; |
|
|
7
|
|
|
|
|
7
|
|
|
|
7
|
|
|
|
|
31
|
|
|
43
|
7
|
|
|
|
|
20
|
$create->( $class, $build->( $class, @args ) ); |
|
44
|
7
|
|
|
|
|
102
|
$factory->sweeten_meth( $spec ); |
|
45
|
7
|
|
|
|
|
34
|
return; |
|
46
|
4
|
|
|
|
|
19
|
}; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |