line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#########1 Main Package 3#########4#########5#########6#########7#########8#########9 |
2
|
|
|
|
|
|
|
package MooseX::ShortCut::BuildInstance; |
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:JANDREW'; |
4
|
|
|
|
|
|
|
# ABSTRACT: A shortcut to build Moose instances |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
343825
|
use version 0.77; our $VERSION = version->declare('v1.34.8'); |
|
1
|
|
|
|
|
2104
|
|
|
1
|
|
|
|
|
8
|
|
7
|
|
|
|
|
|
|
###LogSD warn "You uncovered internal logging statements for Spreadsheet::XLSX::Reader::LibXML-$VERSION"; |
8
|
1
|
|
|
1
|
|
172
|
use 5.010; |
|
1
|
|
|
|
|
5
|
|
9
|
1
|
|
|
1
|
|
937
|
use Moose 2.1213; |
|
1
|
|
|
|
|
346482
|
|
|
1
|
|
|
|
|
8
|
|
10
|
1
|
|
|
1
|
|
7365
|
use Moose::Meta::Class; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1079
|
|
11
|
1
|
|
|
1
|
|
6
|
use Types::Standard 1.000 qw( Bool ); |
|
1
|
|
|
|
|
59
|
|
|
1
|
|
|
|
|
10
|
|
12
|
1
|
|
|
1
|
|
580
|
use Carp qw( cluck confess ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
63
|
|
13
|
1
|
|
|
1
|
|
5
|
use Moose::Util qw( apply_all_roles ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
14
|
1
|
|
|
1
|
|
233
|
use Moose::Exporter; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
15
|
|
|
|
|
|
|
Moose::Exporter->setup_import_methods( |
16
|
|
|
|
|
|
|
as_is => [ |
17
|
|
|
|
|
|
|
'build_instance', |
18
|
|
|
|
|
|
|
'build_class', |
19
|
|
|
|
|
|
|
'should_re_use_classes', |
20
|
|
|
|
|
|
|
'set_class_immutability', |
21
|
|
|
|
|
|
|
], |
22
|
|
|
|
|
|
|
); |
23
|
1
|
|
|
1
|
|
59
|
use Data::Dumper; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
47
|
|
24
|
1
|
|
|
1
|
|
937
|
use Clone 'clone'; |
|
1
|
|
|
|
|
3147
|
|
|
1
|
|
|
|
|
67
|
|
25
|
1
|
|
|
1
|
|
7
|
use lib '../../../lib',; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
26
|
1
|
|
|
|
|
11
|
use MooseX::ShortCut::BuildInstance::Types 1.034 qw( |
27
|
|
|
|
|
|
|
BuildClassDict |
28
|
1
|
|
|
1
|
|
601
|
); |
|
1
|
|
|
|
|
29
|
|
29
|
|
|
|
|
|
|
###LogSD warn "You uncovered internal logging statements for MooseX::ShortCut::BuildInstance!"; |
30
|
|
|
|
|
|
|
###LogSD use Log::Shiras::Telephone; |
31
|
|
|
|
|
|
|
#~ ###LogSD use MooseX::ShortCut::BuildInstance::UnhideDebug; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
#########1 Package Variables 3#########4#########5#########6#########7#########8#########9 |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
our $anonymous_class_count = 0; |
36
|
|
|
|
|
|
|
our $built_classes = {}; |
37
|
|
|
|
|
|
|
our $re_use_classes = 0; |
38
|
|
|
|
|
|
|
our $make_classes_immutable = 1; |
39
|
|
|
|
|
|
|
my @init_class_args = qw( |
40
|
|
|
|
|
|
|
package |
41
|
|
|
|
|
|
|
superclasses |
42
|
|
|
|
|
|
|
roles |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
my @add_class_args = qw( |
45
|
|
|
|
|
|
|
add_roles_in_sequence |
46
|
|
|
|
|
|
|
add_attributes |
47
|
|
|
|
|
|
|
add_methods |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
#########1 Public Methods 3#########4#########5#########6#########7#########8#########9 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub build_class{ |
53
|
|
|
|
|
|
|
|
54
|
7
|
100
|
|
7
|
1
|
15177
|
my $args = ( scalar( @_ ) == 1 ) ? clone( $_[0] ) : { @_ }; |
55
|
|
|
|
|
|
|
###LogSD my $phone = Log::Shiras::Telephone->new( |
56
|
|
|
|
|
|
|
###LogSD name_space => 'build_class', ); |
57
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'info', message =>[ |
58
|
|
|
|
|
|
|
###LogSD "Arrived at build_class with args:", $args, ] ); |
59
|
7
|
|
|
|
|
19
|
my ( $class_args, $i, $can_build, $warning, @warn_list, $pre_exists ); |
60
|
7
|
|
|
|
|
19
|
for my $key ( @init_class_args ){ |
61
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'debug', message =>[ |
62
|
|
|
|
|
|
|
###LogSD "Processing the class argument: $key", ] ); |
63
|
21
|
100
|
|
|
|
74
|
if( exists $args->{$key} ){ |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
64
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'debug', message =>[ |
65
|
|
|
|
|
|
|
###LogSD 'Processing the values:', $args->{$key}, ] ); |
66
|
11
|
|
|
|
|
29
|
$class_args->{$key} = $args->{$key}; |
67
|
11
|
100
|
|
|
|
33
|
if( $key eq 'package' ){ |
68
|
5
|
100
|
|
|
|
24
|
if( $built_classes->{$args->{$key}} ){ |
69
|
2
|
|
|
|
|
4
|
$pre_exists = 1; |
70
|
2
|
100
|
|
|
|
7
|
if( !$re_use_classes ){ |
71
|
1
|
|
|
|
|
4
|
push @warn_list, 'You already built the class: ' . $args->{$key}; |
72
|
1
|
|
|
|
|
2
|
$warning = 1; |
73
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'warn', message =>[ |
74
|
|
|
|
|
|
|
###LogSD "unmutablizing the class ...", @warn_list ] ); |
75
|
1
|
|
|
|
|
7
|
$args->{$key}->meta->make_mutable; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
5
|
|
|
|
|
366
|
$built_classes->{$args->{$key}} = 1; |
79
|
|
|
|
|
|
|
} |
80
|
11
|
|
|
|
|
25
|
delete $args->{$key}; |
81
|
|
|
|
|
|
|
}elsif( $key eq 'package' ){ |
82
|
2
|
|
|
|
|
11
|
$class_args->{$key} = "ANONYMOUS_SHIRAS_MOOSE_CLASS_" . ++$anonymous_class_count; |
83
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'warn', message =>[ |
84
|
|
|
|
|
|
|
###LogSD "missing a package value - using: " . $class_args->{$key} ] ); |
85
|
|
|
|
|
|
|
}elsif( $key eq 'superclasses' ){ |
86
|
|
|
|
|
|
|
### <where> - missing the superclass ... |
87
|
2
|
|
|
|
|
10
|
$class_args->{$key} = [ 'Anonymous::Shiras::Moose::Class' ], |
88
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'warn', message =>[ |
89
|
|
|
|
|
|
|
###LogSD "missing the superclass value - using: " . $class_args->{$key} ] ); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
} |
92
|
7
|
100
|
|
|
|
19
|
if( $warning ){ |
93
|
1
|
|
|
|
|
9
|
push @warn_list, 'The old class definitions will be overwritten with args:', Dumper( $class_args ); |
94
|
1
|
|
|
|
|
162
|
cluck( join( "\n", @warn_list ) ); |
95
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'warn', message =>[ |
96
|
|
|
|
|
|
|
###LogSD 'The old class definitions will be overwritten with args:', $class_args ] ); |
97
|
|
|
|
|
|
|
} |
98
|
7
|
|
|
|
|
1539
|
my $want_array = ( caller(0) )[5]; |
99
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'trace', message =>[ |
100
|
|
|
|
|
|
|
###LogSD 'class args:', $class_args, 'remaining arguments:', $args, |
101
|
|
|
|
|
|
|
###LogSD "want array: $want_array", "Pre exists state: " . ($pre_exists//''), |
102
|
|
|
|
|
|
|
###LogSD "\$warning state: " . ($warning//''), 'finalize the class name or load a new one ...' ] ); |
103
|
|
|
|
|
|
|
my $class_name = ( $pre_exists and !$warning ) ? |
104
|
|
|
|
|
|
|
$class_args->{package} : |
105
|
7
|
100
|
100
|
|
|
329
|
Moose::Meta::Class->create( %{$class_args} )->name; |
|
6
|
|
|
|
|
49
|
|
106
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'debug', message =>[ |
107
|
|
|
|
|
|
|
###LogSD 'class to this point: ' . $class_name->dump( 2 ) ] ); |
108
|
7
|
50
|
33
|
|
|
123538
|
if( !$class_name->meta->is_mutable and |
|
|
|
66
|
|
|
|
|
109
|
|
|
|
|
|
|
( exists $args->{add_attributes} or |
110
|
|
|
|
|
|
|
exists $args->{add_methods} or |
111
|
|
|
|
|
|
|
exists $args->{add_roles_in_sequence} ) ){ |
112
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'info', message =>[ |
113
|
|
|
|
|
|
|
###LogSD 'Unmutablizing the class ...' ] ); |
114
|
0
|
|
|
|
|
0
|
$class_name->meta->make_mutable; |
115
|
|
|
|
|
|
|
} |
116
|
7
|
100
|
|
|
|
186
|
if( exists $args->{add_attributes} ){ |
117
|
1
|
|
|
|
|
5
|
my $meta = $class_name->meta; |
118
|
1
|
|
|
|
|
14
|
for my $attribute ( keys %{$args->{add_attributes}} ){ |
|
1
|
|
|
|
|
5
|
|
119
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'debug', message =>[ |
120
|
|
|
|
|
|
|
###LogSD "adding attribute named: $attribute" ] ); |
121
|
1
|
|
|
|
|
10
|
$meta->add_attribute( $attribute => $args->{add_attributes}->{$attribute} ); |
122
|
|
|
|
|
|
|
} |
123
|
1
|
|
|
|
|
2687
|
delete $args->{add_attributes}; |
124
|
|
|
|
|
|
|
} |
125
|
7
|
100
|
|
|
|
23
|
if( exists $args->{add_methods} ){ |
126
|
4
|
|
|
|
|
16
|
my $meta = $class_name->meta; |
127
|
4
|
|
|
|
|
60
|
for my $method ( keys %{$args->{add_methods}} ){ |
|
4
|
|
|
|
|
18
|
|
128
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'debug', message =>[ |
129
|
|
|
|
|
|
|
###LogSD "adding method named: $method" ] ); |
130
|
5
|
|
|
|
|
80
|
$meta->add_method( $method => $args->{add_methods}->{$method} ); |
131
|
|
|
|
|
|
|
} |
132
|
4
|
|
|
|
|
202
|
delete $args->{add_methods}; |
133
|
|
|
|
|
|
|
} |
134
|
7
|
100
|
|
|
|
27
|
if( exists $args->{add_roles_in_sequence} ){ |
135
|
4
|
|
|
|
|
30
|
for my $role ( @{$args->{add_roles_in_sequence}} ){ |
|
4
|
|
|
|
|
11
|
|
136
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'debug', message =>[ "adding role: $role" ] ); |
137
|
4
|
|
|
|
|
18
|
apply_all_roles( $class_name, $role ); |
138
|
|
|
|
|
|
|
} |
139
|
4
|
|
|
|
|
21709
|
delete $args->{add_roles_in_sequence}; |
140
|
|
|
|
|
|
|
} |
141
|
7
|
50
|
|
|
|
25
|
if( $make_classes_immutable ){ |
142
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'info', message =>[ |
143
|
|
|
|
|
|
|
###LogSD 'Immutablizing the class ...' ] ); |
144
|
7
|
|
|
|
|
31
|
$class_name->meta->make_immutable; |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'info', message =>[ |
147
|
|
|
|
|
|
|
###LogSD "returning: $class_name" ] ); |
148
|
7
|
|
|
|
|
2158
|
return $class_name; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub build_instance{ |
152
|
3
|
50
|
|
3
|
1
|
6436
|
my $args = ( ref $_[0] eq 'HASH' ) ? clone( $_[0] ) : { @_ }; |
153
|
|
|
|
|
|
|
###LogSD my $phone = Log::Shiras::Telephone->new( |
154
|
|
|
|
|
|
|
###LogSD name_space => 'build_instance', ); |
155
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'info', message =>[ |
156
|
|
|
|
|
|
|
###LogSD "Arrived at build_instance with args:", $args, ] ); |
157
|
3
|
|
|
|
|
5
|
my $class_args; |
158
|
3
|
|
|
|
|
13
|
for my $key ( @init_class_args, @add_class_args ){ |
159
|
18
|
100
|
|
|
|
48
|
if( exists $args->{$key} ){ |
160
|
8
|
|
|
|
|
18
|
$class_args->{$key} = $args->{$key}; |
161
|
8
|
|
|
|
|
15
|
delete $args->{$key}; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'trace', message =>[ |
165
|
|
|
|
|
|
|
###LogSD 'Reduced arguments:', $args, |
166
|
|
|
|
|
|
|
###LogSD 'Class building arguments:', $class_args, ] ); |
167
|
3
|
|
|
|
|
10
|
my $class = build_class( $class_args ); |
168
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'warn', message =>[ |
169
|
|
|
|
|
|
|
###LogSD "Built class name: $class", |
170
|
|
|
|
|
|
|
###LogSD "To get instance now applying args:", $args, ] ); |
171
|
3
|
|
|
|
|
8
|
my $instance; |
172
|
3
|
|
|
|
|
181
|
eval '$instance = $class->new( %$args )'; |
173
|
3
|
50
|
|
|
|
15
|
if( $@ ){ |
174
|
0
|
|
|
|
|
0
|
my $message = $@; |
175
|
0
|
0
|
|
|
|
0
|
if( ref $message ){ |
176
|
0
|
0
|
|
|
|
0
|
if( $message->can( 'as_string' ) ){ |
|
|
0
|
|
|
|
|
|
177
|
0
|
|
|
|
|
0
|
$message = $message->as_string; |
178
|
|
|
|
|
|
|
}elsif( $message->can( 'message' ) ){ |
179
|
0
|
|
|
|
|
0
|
$message = $message->message; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
} |
182
|
0
|
|
|
|
|
0
|
$message =~ s/\)\n;/\);/g; |
183
|
|
|
|
|
|
|
###LogSD if( 1 ){ |
184
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'warn', message =>[ |
185
|
|
|
|
|
|
|
###LogSD "Failed to build -$class- for: $message", ] ); |
186
|
|
|
|
|
|
|
###LogSD }else{ |
187
|
0
|
|
|
|
|
0
|
cluck $message; |
188
|
|
|
|
|
|
|
###LogSD } |
189
|
|
|
|
|
|
|
}else{ |
190
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'trace', message =>[ |
191
|
|
|
|
|
|
|
###LogSD "Built instance:", $instance, ] ); |
192
|
3
|
|
|
|
|
22
|
return $instance; |
193
|
|
|
|
|
|
|
} |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
sub should_re_use_classes{ |
197
|
1
|
|
|
1
|
1
|
2561
|
my ( $bool, ) = @_; |
198
|
|
|
|
|
|
|
###LogSD my $phone = Log::Shiras::Telephone->new( |
199
|
|
|
|
|
|
|
###LogSD name_space => 'should_re_use_classes', ); |
200
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'info', message =>[ |
201
|
|
|
|
|
|
|
###LogSD "setting \$re_use_classes to: $bool", ] ); |
202
|
1
|
50
|
|
|
|
8
|
$re_use_classes = ( $bool ) ? 1 : 0 ; |
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
sub set_class_immutability{ |
206
|
0
|
|
|
0
|
1
|
|
my ( $bool, ) = @_; |
207
|
|
|
|
|
|
|
###LogSD my $phone = Log::Shiras::Telephone->new( |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
###LogSD name_space => 'set_class_immutability', ); |
210
|
|
|
|
|
|
|
###LogSD $phone->talk( level => 'info', message =>[ |
211
|
|
|
|
|
|
|
###LogSD "setting \$make_immutable_classes to; $bool", ] ); |
212
|
0
|
0
|
|
|
|
|
$make_classes_immutable = ( $bool ) ? 1 : 0 ; |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
#########1 Phinish strong 3#########4#########5#########6#########7#########8#########9 |
216
|
|
|
|
|
|
|
|
217
|
1
|
|
|
1
|
|
1413
|
no Moose; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
9
|
|
218
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
#########1 Default class 3#########4#########5#########6#########7#########8#########9 |
221
|
|
|
|
|
|
|
package Anonymous::Shiras::Moose::Class; |
222
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:JANDREW'; |
223
|
1
|
|
|
1
|
|
270
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
224
|
1
|
|
|
1
|
|
7232
|
no Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
1; |
227
|
|
|
|
|
|
|
# The preceding line will help the module return a true value |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
#########1 main pod docs 3#########4#########5#########6#########7#########8#########9 |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
__END__ |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=head1 NAME |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
MooseX::ShortCut::BuildInstance - A shortcut to build Moose instances |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=begin html |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
<a href="https://www.perl.org"> |
240
|
|
|
|
|
|
|
<img src="https://img.shields.io/badge/perl-5.10+-brightgreen.svg" alt="perl version"> |
241
|
|
|
|
|
|
|
</a> |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
<a href="https://travis-ci.org/jandrew/MooseX-ShortCut-BuildInstance"> |
244
|
|
|
|
|
|
|
<img alt="Build Status" src="https://travis-ci.org/jandrew/MooseX-ShortCut-BuildInstance.png?branch=master" alt='Travis Build'/> |
245
|
|
|
|
|
|
|
</a> |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
<a href='https://coveralls.io/r/jandrew/MooseX-ShortCut-BuildInstance?branch=master'> |
248
|
|
|
|
|
|
|
<img src='https://coveralls.io/repos/jandrew/MooseX-ShortCut-BuildInstance/badge.svg?branch=master' alt='Coverage Status' /> |
249
|
|
|
|
|
|
|
</a> |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
<a> |
252
|
|
|
|
|
|
|
<img src="https://img.shields.io/badge/this version-1.34.8-brightgreen.svg" alt="this version"> |
253
|
|
|
|
|
|
|
</a> |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
<a href="https://metacpan.org/pod/MooseX::ShortCut::BuildInstance"> |
256
|
|
|
|
|
|
|
<img src="https://badge.fury.io/pl/MooseX-ShortCut-BuildInstance.svg?label=cpan version" alt="CPAN version" height="20"> |
257
|
|
|
|
|
|
|
</a> |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
<a href='http://cpants.cpanauthors.org/dist/MooseX-ShortCut-BuildInstance'> |
260
|
|
|
|
|
|
|
<img src='http://cpants.cpanauthors.org/dist/MooseX-ShortCut-BuildInstance.png' alt='kwalitee' height="20"/> |
261
|
|
|
|
|
|
|
</a> |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=end html |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=head1 SYNOPSIS |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
#!perl |
268
|
|
|
|
|
|
|
package Mineral; |
269
|
|
|
|
|
|
|
use Moose; |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
has 'type' =>( is => 'ro' ); |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
package Identity; |
274
|
|
|
|
|
|
|
use Moose::Role; |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
has 'name' =>( is => 'ro' ); |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
use MooseX::ShortCut::BuildInstance; |
279
|
|
|
|
|
|
|
use Test::More; |
280
|
|
|
|
|
|
|
use Test::Moose; |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
my $paco = build_instance( |
283
|
|
|
|
|
|
|
package => 'Pet::Rock', |
284
|
|
|
|
|
|
|
superclasses =>['Mineral'], |
285
|
|
|
|
|
|
|
roles =>['Identity'], |
286
|
|
|
|
|
|
|
type => 'Quartz', |
287
|
|
|
|
|
|
|
name => 'Paco', |
288
|
|
|
|
|
|
|
); |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
does_ok( $paco, 'Identity', 'Check that the ' . $paco->meta->name . ' has an -Identity-' ); |
291
|
|
|
|
|
|
|
print'My ' . $paco->meta->name . ' made from -' . $paco->type . '- (a ' . |
292
|
|
|
|
|
|
|
( join ', ', $paco->meta->superclasses ) . ') is called -' . $paco->name . "-\n"; |
293
|
|
|
|
|
|
|
done_testing(); |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
############################################################################## |
296
|
|
|
|
|
|
|
# Output of SYNOPSIS |
297
|
|
|
|
|
|
|
# 01:ok 1 - Check that the Pet::Rock has an -Identity- |
298
|
|
|
|
|
|
|
# 02:My Pet::Rock made from -Quartz- (a Mineral) is called -Paco- |
299
|
|
|
|
|
|
|
# 03:1..1 |
300
|
|
|
|
|
|
|
############################################################################## |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=head1 DESCRIPTION |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
This module is a shortcut to custom build L<Moose> class instances on the fly. |
306
|
|
|
|
|
|
|
The goal is to compose unique instances of Moose classes on the fly using a single |
307
|
|
|
|
|
|
|
function call with information describing required attributes, methods, inherited |
308
|
|
|
|
|
|
|
classes, and roles as well as any instance settings to apply in a |
309
|
|
|
|
|
|
|
L<DCI|https://en.wikipedia.org/wiki/Data,_Context,_and_Interaction> fashion. |
310
|
|
|
|
|
|
|
This package will check for and fill in any missing pieces as needed so that your |
311
|
|
|
|
|
|
|
call can either be complex or very simple. The goal is to provide configurable |
312
|
|
|
|
|
|
|
instance building without stringing together a series of Class-E<gt>method( %args ) |
313
|
|
|
|
|
|
|
calls. |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
The package can also be used as a class factory with the L<should_re_use_classes |
316
|
|
|
|
|
|
|
|/$MooseX::ShortCut::BuildInstance::re_use_classes> method. |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
Even though this is a Moose based class it provides a functional interface. |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
=head1 WARNING |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
Moose (and I think perl 5) can't have two classes with the same name but |
323
|
|
|
|
|
|
|
different guts coexisting! This means that if you build a class (package) name |
324
|
|
|
|
|
|
|
on the fly while building an instance and then recompose a new class (package) with |
325
|
|
|
|
|
|
|
the same name but different functionality (different attributes, methods, inherited |
326
|
|
|
|
|
|
|
classes or roles) while composing a new instance on the fly then all calls |
327
|
|
|
|
|
|
|
to the old instance will use the new class functionality for execution. (Usually |
328
|
|
|
|
|
|
|
causing hard to troubleshoot failures) |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
MooseX::ShortCut::BuildInstance will warn if you overwrite named classes (packages) |
331
|
|
|
|
|
|
|
built on top of another class (package) also built by MooseX::ShortCut::BuildInstance. |
332
|
|
|
|
|
|
|
If you are using the 'build_instance' method to generate multiple instances of |
333
|
|
|
|
|
|
|
the same class (by 'package' name) with different attribute settings but built |
334
|
|
|
|
|
|
|
with the same functionality then you need to understand the purpose of the |
335
|
|
|
|
|
|
|
L<$re_use_classes|/$MooseX::ShortCut::BuildInstance::re_use_classes> global variable. |
336
|
|
|
|
|
|
|
An alternative to multiple calls straight to 'build_instance' is to call |
337
|
|
|
|
|
|
|
L<build_class|/build_class( %args|\%args )> separately and then just call -E<gt>new |
338
|
|
|
|
|
|
|
against the resulting class name over and over again. Another alternative is to |
339
|
|
|
|
|
|
|
leave the 'package' argument out of 'build_instance' and let this class create a |
340
|
|
|
|
|
|
|
unique by-instance anonymous class/package name. |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
The Types module in this package uses L<Type::Tiny> which can, in the |
343
|
|
|
|
|
|
|
background, use L<Type::Tiny::XS>. While in general this is a good thing you will |
344
|
|
|
|
|
|
|
need to make sure that Type::Tiny::XS is version 0.010 or newer since the older |
345
|
|
|
|
|
|
|
ones didn't support the 'Optional' method. |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
=head1 Functions for Export |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=head2 build_instance( %args|\%args ) |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
=over |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
B<Definition:> This method is used to create a Moose instance on the fly. |
354
|
|
|
|
|
|
|
I<It assumes that you do not have the class pre-built and will look for the |
355
|
|
|
|
|
|
|
needed information to compose a new class as well.> Basically this passes the |
356
|
|
|
|
|
|
|
%args intact to L<build_class|/build_class( %args|\%args )> first. All the |
357
|
|
|
|
|
|
|
relevant class building pieces will be used and removed from the args and then |
358
|
|
|
|
|
|
|
this method will run $returned_class_name->new( %remaining_args ) with what is |
359
|
|
|
|
|
|
|
left. |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
B<Accepts:> a hash or hashref of arguments. They must include the |
362
|
|
|
|
|
|
|
necessary information to build a class. I<(if you already have a class just |
363
|
|
|
|
|
|
|
call $class-E<gt>new( %args ); instead of this method!)> This hashref can also |
364
|
|
|
|
|
|
|
contain any attribute settings for the instance as well. See |
365
|
|
|
|
|
|
|
L<build_class|/build_class( %args|\%args )> for more information. |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
B<Returns:> This will return a blessed instance of your new class with |
368
|
|
|
|
|
|
|
the passed attribute settings implemented. |
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
=back |
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
=head2 build_class( %args|\%args ) |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
=over |
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
B<Definition:> This function is used to compose a Moose class on the fly. The |
377
|
|
|
|
|
|
|
the goal is to allow for as much or as little class definition as you want to be |
378
|
|
|
|
|
|
|
provided by one function call. The goal is also to remove as much of the boilerplate |
379
|
|
|
|
|
|
|
and logic sequences for class building as possible and let this package handle that. |
380
|
|
|
|
|
|
|
The function begins by using the L<Moose::Meta::Class>-E<gt>class(%args) method. |
381
|
|
|
|
|
|
|
For this part the function specifically uses the argument callouts 'package', |
382
|
|
|
|
|
|
|
'superclasses', and 'roles'. Any necessary missing pieces will be provided. I<Even |
383
|
|
|
|
|
|
|
though L<Moose::Meta::Class>-E<gt>class(%args) allows for the package name to be called |
384
|
|
|
|
|
|
|
as the first element of an odd numbered list this implementation does not. To define |
385
|
|
|
|
|
|
|
a 'package' name it must be set as the value of the 'package' key in the %args.> |
386
|
|
|
|
|
|
|
This function then takes the following arguements; 'add_attributes', 'add_methods', |
387
|
|
|
|
|
|
|
and 'add_roles_in_sequence' and implements them in that order. The |
388
|
|
|
|
|
|
|
implementation of these values is done with L<Moose::Util> 'apply_all_roles' |
389
|
|
|
|
|
|
|
and the meta capability in L<Moose>. |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
B<Accepts:> a hash or hashref of arguments. Six keys are stripped from the hash or |
392
|
|
|
|
|
|
|
hash ref of arguments. I<These keys are always used to build the class. They are |
393
|
|
|
|
|
|
|
never passed on to %remaining_args.> |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
=over |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
B<The first three key-E<gt>value pairs are consumed simultaneously>. They are; |
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
=over |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
B<package:> This is the name (a string) that the new instance of |
402
|
|
|
|
|
|
|
a this class is blessed under. If this key is not provided the package |
403
|
|
|
|
|
|
|
will generate a generic name. This will L<overwrite|/WARNING> any class |
404
|
|
|
|
|
|
|
built earlier with the same name. |
405
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
=over |
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
B<accepts:> a string |
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
=back |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
B<superclasses:> this is intentionally the same key from |
413
|
|
|
|
|
|
|
Moose::Meta::Class-E<gt>create. |
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
=over |
416
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
B<accepts:> a recognizable (by Moose) class name |
418
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
=back |
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
B<roles:> this is intentionally the same key from Moose::Meta::Class |
422
|
|
|
|
|
|
|
-E<gt>create. |
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
=over |
425
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
B<accepts:> a recognizable (by Moose) class name |
427
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
=back |
429
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
=back |
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
B<The second three key-E<gt>value pairs are consumed in the following |
433
|
|
|
|
|
|
|
sequence>. They are; |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
=over |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
B<add_attributes:> this will add attributes to the class using the |
438
|
|
|
|
|
|
|
L<Moose::Meta::Class>-E<gt>add_attribute method. Because these definitions |
439
|
|
|
|
|
|
|
are passed as key / value pairs in a hash ref they are not added in |
440
|
|
|
|
|
|
|
any specific order. |
441
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
=over |
443
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
B<accepts:> a hash ref where the keys are attribute names and the values |
445
|
|
|
|
|
|
|
are hash refs of the normal definitions used to define a Moose attribute. |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
=back |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
B<add_methods:> this will add methods to the class using the |
451
|
|
|
|
|
|
|
L<Moose::Meta::Class>-E<gt>add_method method. Because these definitions |
452
|
|
|
|
|
|
|
are passed as key / value pairs in a hash ref they are not added in |
453
|
|
|
|
|
|
|
any specific order. |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
=over |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
B<accepts:> a hash ref where the keys are method names and the values |
458
|
|
|
|
|
|
|
are anonymous subroutines or subroutine references. |
459
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
=back |
461
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
B<add_roles_in_sequence:> this will compose, in sequence, each role in |
463
|
|
|
|
|
|
|
the array ref into the class built on the prior three arguments using |
464
|
|
|
|
|
|
|
L<Moose::Util> apply_all_roles. This will allow an added role to |
465
|
|
|
|
|
|
|
'require' elements of a role earlier in the sequence. The roles |
466
|
|
|
|
|
|
|
implemented with the L<role|/roles:> key are installed first and in a |
467
|
|
|
|
|
|
|
group. Then these roles are installed one at a time. |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
=over |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
B<accepts:> an array ref list of roles recognizable (by Moose) as roles |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
=back |
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
=back |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
=back |
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
B<Returns:> This will check the caller and see if it wants an array or a |
480
|
|
|
|
|
|
|
scalar. In array context it returns the new class name and a hash ref of the |
481
|
|
|
|
|
|
|
unused hash key/value pairs. These are presumably the arguments for the |
482
|
|
|
|
|
|
|
instance. If the requested return is a scalar it just returns the name of |
483
|
|
|
|
|
|
|
the newly created class. |
484
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
=back |
486
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
=head2 should_re_use_classes( $bool ) |
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
=over |
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
This sets/changes the global variable |
492
|
|
|
|
|
|
|
L<MooseX::ShortCut::BuildInstance::re_use_classes |
493
|
|
|
|
|
|
|
|/$MooseX::ShortCut::BuildInstance::re_use_classes> |
494
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
=back |
496
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
=head2 set_class_immutability( $bool ) |
498
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
=over |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
This sets/changes the global variable |
502
|
|
|
|
|
|
|
L<MooseX::ShortCut::BuildInstance::make_classes_immutable |
503
|
|
|
|
|
|
|
|/$MooseX::ShortCut::BuildInstance::make_classes_immutable> |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
=back |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
=head1 GLOBAL VARIABLES |
508
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
=head2 $MooseX::ShortCut::BuildInstance::anonymous_class_count |
510
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
This is an integer that increments and appends to the anonymous package name |
512
|
|
|
|
|
|
|
for each new anonymous package (class) created. |
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
=head2 $MooseX::ShortCut::BuildInstance::built_classes |
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
This is a hashref that tracks the class names ('package's) built buy this class |
517
|
|
|
|
|
|
|
to manage duplicate build behaviour. |
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
=head2 $MooseX::ShortCut::BuildInstance::re_use_classes |
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
This is a boolean (1|0) variable that tracks if the class should overwrite or |
522
|
|
|
|
|
|
|
re-use a package name (and the defined class) from a prior 'build_class' call. |
523
|
|
|
|
|
|
|
If the package name is overwritten it will L<cluck|https://metacpan.org/pod/Carp#SYNOPSIS> |
524
|
|
|
|
|
|
|
in warning since any changes will affect active instances of prior class builds |
525
|
|
|
|
|
|
|
with the same name. If you wish to avoid changing old built behaviour at the risk |
526
|
|
|
|
|
|
|
of not installing new behaviour then set this variable to true. I<No warning will |
527
|
|
|
|
|
|
|
be provided if new requested class behaviour is discarded.> The class reuse behaviour |
528
|
|
|
|
|
|
|
can be changed with the exported method L<should_re_use_classes |
529
|
|
|
|
|
|
|
|/should_re_use_classes( $bool )>. |
530
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
=over |
532
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
B<Default:> False = warn then overwrite |
534
|
|
|
|
|
|
|
|
535
|
|
|
|
|
|
|
=back |
536
|
|
|
|
|
|
|
|
537
|
|
|
|
|
|
|
=head2 $MooseX::ShortCut::BuildInstance::make_classes_immutable |
538
|
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
This is a boolean (1|0) variable that manages whether a class is immutabilized at the end of |
540
|
|
|
|
|
|
|
creation. This can be changed with the exported method L<set_class_immutability |
541
|
|
|
|
|
|
|
|/set_class_immutability( $bool )>. |
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
=head1 Build/Install from Source |
544
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
=over |
546
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
B<1.> Download a compressed file with the code |
548
|
|
|
|
|
|
|
|
549
|
|
|
|
|
|
|
B<2.> Extract the code from the compressed file. |
550
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
=over |
552
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
If you are using tar this should work: |
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
tar -zxvf Spreadsheet-XLSX-Reader-LibXML-v0.xx.tar.gz |
556
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
=back |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
B<3.> Change (cd) into the extracted directory |
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
B<4.> Run the following |
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
=over |
564
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
(For Windows find what version of make was used to compile your perl) |
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
perl -V:make |
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
(for Windows below substitute the correct make function (s/make/dmake/g)?) |
570
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
=back |
572
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
>perl Makefile.PL |
574
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
>make |
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
>make test |
578
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
>make install # As sudo/root |
580
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
>make clean |
582
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
=back |
584
|
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
=head1 SUPPORT |
586
|
|
|
|
|
|
|
|
587
|
|
|
|
|
|
|
=over |
588
|
|
|
|
|
|
|
|
589
|
|
|
|
|
|
|
L<MooseX-ShortCut-BuildInstance/issues|https://github.com/jandrew/MooseX-ShortCut-BuildInstance/issues> |
590
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
=back |
592
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
=head1 TODO |
594
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
=over |
596
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
B<1.> Pending ideas |
598
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
=back |
600
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
=head1 AUTHOR |
602
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
=over |
604
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
Jed Lund |
606
|
|
|
|
|
|
|
|
607
|
|
|
|
|
|
|
jandrew@cpan.org |
608
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
=back |
610
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
=head1 COPYRIGHT |
612
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
This program is free software; you can redistribute |
614
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
615
|
|
|
|
|
|
|
|
616
|
|
|
|
|
|
|
The full text of the license can be found in the |
617
|
|
|
|
|
|
|
LICENSE file included with this module. |
618
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
This software is copyrighted (c) 2012, 2015 by Jed Lund |
620
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
=head1 Dependencies |
622
|
|
|
|
|
|
|
|
623
|
|
|
|
|
|
|
=over |
624
|
|
|
|
|
|
|
|
625
|
|
|
|
|
|
|
L<version> |
626
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
L<5.010|http://perldoc.perl.org/perl5100delta.html> (for use of |
628
|
|
|
|
|
|
|
L<defined or|http://perldoc.perl.org/perlop.html#Logical-Defined-Or> //) |
629
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
L<Moose> |
631
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
L<Moose::Meta::Class> |
633
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
L<Carp> - cluck |
635
|
|
|
|
|
|
|
|
636
|
|
|
|
|
|
|
L<Moose::Exporter> |
637
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
L<Moose::Util> - apply_all_roles |
639
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
L<Moose::Exporter> |
641
|
|
|
|
|
|
|
|
642
|
|
|
|
|
|
|
L<Type::Tiny> - 1.000 |
643
|
|
|
|
|
|
|
|
644
|
|
|
|
|
|
|
L<Data::Dumper> |
645
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
L<MooseX::ShortCut::BuildInstance::Types> |
647
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
=back |
649
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
=head1 SEE ALSO |
651
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
=over |
653
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
L<Moose::Meta::Class> ->create |
655
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
L<Moose::Util> ->with_traits |
657
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
L<MooseX::ClassCompositor> |
659
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
L<Log::Shiras|https://github.com/jandrew/Log-Shiras> |
661
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
=over |
663
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
This package does not use Log::Shiras functionality by default. The functionality is |
665
|
|
|
|
|
|
|
only turned on if the variable $ENV{log_shiras_filter_on} is set to true. Otherwise |
666
|
|
|
|
|
|
|
all the Log::Shiras code is hidden as comments. See |
667
|
|
|
|
|
|
|
L<MooseX::ShortCut::BuildInstance::UnhideDebug> for more information. |
668
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
=back |
670
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
=back |
672
|
|
|
|
|
|
|
|
673
|
|
|
|
|
|
|
=cut |
674
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
#########1#########2 main pod documentation end 5#########6#########7#########8#########9 |