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