line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catalyst::Model::InjectionHelpers::Application; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
15
|
use Moose; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
14
|
|
4
|
|
|
|
|
|
|
with 'Catalyst::ComponentRole::InjectionHelpers'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
has instance => ( |
7
|
|
|
|
|
|
|
is=>'ro', |
8
|
|
|
|
|
|
|
init_arg=>undef, |
9
|
|
|
|
|
|
|
lazy=>1, |
10
|
|
|
|
|
|
|
required=>1, |
11
|
|
|
|
|
|
|
default=>sub {$_[0]->build_new_instance($_[0]->application)} ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub COMPONENT { |
14
|
3
|
|
|
3
|
0
|
50
|
my ($self, $app, @ignored) = @_; |
15
|
3
|
|
|
|
|
109
|
return $self->instance; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub expand_modules { |
19
|
0
|
|
|
0
|
0
|
|
my ($self, @args); |
20
|
0
|
0
|
|
|
|
|
return $self->instance->can('expand_modules') |
21
|
|
|
|
|
|
|
? $self->instance->expand_modules(@args) |
22
|
|
|
|
|
|
|
: undef; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 NAME |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Catalyst::Model::InjectionHelpers::Application - Adaptor for application scoped models |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 SYNOPSIS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
package MyApp; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
use Catalyst 'InjectionHelper'; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
MyApp->inject_components( |
38
|
|
|
|
|
|
|
'Model::ApplicationScoped' => { |
39
|
|
|
|
|
|
|
from_class=>'MyApp::Singleton', |
40
|
|
|
|
|
|
|
adaptor=>'Application', |
41
|
|
|
|
|
|
|
roles=>['MyApp::Role::Foo'], |
42
|
|
|
|
|
|
|
method=>sub { |
43
|
|
|
|
|
|
|
my ($adaptor, $class, $app, %args) = @_; |
44
|
|
|
|
|
|
|
return $class->new(aaa=>$args{arg}); |
45
|
|
|
|
|
|
|
}, |
46
|
|
|
|
|
|
|
}); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
MyApp->config( |
49
|
|
|
|
|
|
|
'Model::ApplicationScoped' => { aaa=>100 }, |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
MyApp->setup; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 DESCRIPTION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Injection helper adaptor for application scoped model. See L<Catalyst::Plugin::InjectionHelpers> |
57
|
|
|
|
|
|
|
for details. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 AUTHOR |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
John Napiorkowski L<email:jjnapiork@cpan.org> |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 SEE ALSO |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
L<Catalyst::Plugin::InjectionHelpers> |
66
|
|
|
|
|
|
|
L<Catalyst>, L<Catalyst::Model::InjectionHelpers::Application>, |
67
|
|
|
|
|
|
|
L<Catalyst::Model::InjectionHelpers::Factory>, L<Catalyst::Model::InjectionHelpers::PerRequest> |
68
|
|
|
|
|
|
|
L<Catalyst::ModelRole::InjectionHelpers> |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Copyright 2016, John Napiorkowski L<email:jjnapiork@cpan.org> |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
75
|
|
|
|
|
|
|
the same terms as Perl itself. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |