1Catalyst::Component::InUsstearncCeoPnetrrCiobnutteeCxdatt(Pa3el)rylstD:o:cCuommepnotnaetnito:n:InstancePerContext(3)
2
3
4
6 Catalyst::Component::InstancePerContext - Return a new instance a
7 component on each request
8
10 package MyComponent;
11 use Moose;
12 with 'Catalyst::Component::InstancePerContext';
13
14 sub build_per_context_instance{
15 my ($self, $c) = @_;
16 # ... do your thing here
17 return SomeModule->new(%args);
18 }
19
21 Your consuming class must implement the following method.
22
23 build_per_context_instance
24 The value returned by this call is what you will recieve when you call
25 $c->component('YourComponent').
26
28 This role will add the following method to your consuming class.
29
30 ACCEPT_CONTEXT
31 If the context is not blessed, it will simple pass through the value of
32 "build_per_context_instance". If context is blessed it will look in the
33 "stash" for an instance of the requested component and return that or,
34 if the value is not found, the value returned by
35 "build_per_context_instance" will be stored and return.
36
37 The idea behind this behavior is that a component can be built on a
38 per-request basis, as the name of this module implies.
39
41 Moose, Moose::Role, Catalyst::Component
42
44 Guillermo Roditi (groditi) <groditi@cpan.org>
45
47 You may distribute this code under the same terms as Perl itself.
48
49
50
51perl v5.28.0 200C7a-t0a6l-y0s7t::Component::InstancePerContext(3)