line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catalyst::Model::InjectionHelpers::Factory; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
15
|
use Moose; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
14
|
|
4
|
|
|
|
|
|
|
with 'Catalyst::ComponentRole::InjectionHelpers'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub ACCEPT_CONTEXT { |
7
|
4
|
|
|
4
|
0
|
4139
|
my ($self, $c, @args) = @_; |
8
|
4
|
|
|
|
|
13
|
return $self->build_new_instance($c, @args); |
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Catalyst::Model::InjectionHelpers::Factory - Adaptor that is a model factory |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 SYNOPSIS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
package MyApp; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use Catalyst 'InjectionHelper'; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
MyApp->inject_components( |
24
|
|
|
|
|
|
|
'Model::Factory' => { |
25
|
|
|
|
|
|
|
from_class=>'MyApp::Factory', |
26
|
|
|
|
|
|
|
adaptor=>'Factory', |
27
|
|
|
|
|
|
|
method=>'new' |
28
|
|
|
|
|
|
|
}); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
MyApp->config( |
31
|
|
|
|
|
|
|
'Model::Factory' => { aaa=>100 }, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
MyApp->setup; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 DESCRIPTION |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Injection helper adaptor that returns a new model each time you request it, scoped |
39
|
|
|
|
|
|
|
to the request. See L<Catalyst::Plugin::InjectionHelpers> |
40
|
|
|
|
|
|
|
for details. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 AUTHOR |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
John Napiorkowski L<email:jjnapiork@cpan.org> |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 SEE ALSO |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
L<Catalyst::Plugin::InjectionHelpers> |
49
|
|
|
|
|
|
|
L<Catalyst>, L<Catalyst::Model::InjectionHelpers::Application>, |
50
|
|
|
|
|
|
|
L<Catalyst::Model::InjectionHelpers::Factory>, L<Catalyst::Model::InjectionHelpers::PerRequest> |
51
|
|
|
|
|
|
|
L<Catalyst::ModelRole::InjectionHelpers> |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Copyright 2016, John Napiorkowski L<email:jjnapiork@cpan.org> |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
58
|
|
|
|
|
|
|
the same terms as Perl itself. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |