-
-
07 Jun 2007 17:15:19 UTC
- Distribution: Catalyst-Component-InstancePerContext
- Module version: 0.001001
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (3)
- Testers (13554 / 10 / 0)
- Kwalitee
Bus factor: 2- 93.33% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (18.47KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Catalyst
- Moose
- Scalar::Util
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Catalyst::Component::InstancePerContext - Return a new instance a component on each request
SYNOPSYS
package MyComponent; use Moose; with 'Catalyst::Component::InstancePerContext'; sub build_per_context_instance{ my ($self, $c) = @_; # ... do your thing here return SomeModule->new(%args); }
REQUIRED METHODS
Your consuming class must implement the following method.
build_per_context_instance
The value returned by this call is what you will recieve when you call $c->component('YourComponent').
PROVIDED METHODS
This role will add the following method to your consuming class.
ACCEPT_CONTEXT
If the context is not blessed, it will simple pass through the value of
build_per_context_instance
. If context is blessed it will look in thestash
for an instance of the requested component and return that or, if the value is not found, the value returned bybuild_per_context_instance
will be stored and return.The idea behind this behavior is that a component can be built on a per-request basis, as the name of this module implies.
SEE ALSO
Moose, Moose::Role, Catalyst::Component
AUTHOR
Guillermo Roditi (groditi) <groditi@cpan.org>
LICENSE
You may distribute this code under the same terms as Perl itself.
Module Install Instructions
To install Catalyst::Component::InstancePerContext, copy and paste the appropriate command in to your terminal.
cpanm Catalyst::Component::InstancePerContext
perl -MCPAN -e shell install Catalyst::Component::InstancePerContext
For more information on module installation, please visit the detailed CPAN module installation guide.