GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Catalyst::Component::InstancePerContext(3) User Contributed Perl Documentation Catalyst::Component::InstancePerContext(3)

Catalyst::Component::InstancePerContext - Return a new instance a component on each request

    package MyComponent;
    use Moose;
    with 'Catalyst::Component::InstancePerContext';

    sub build_per_context_instance{
        my ($self, $c) = @_;
        # ... do your thing here
        return SomeModule->new(%args);
    }

Your consuming class must implement the following method.

The value returned by this call is what you will recieve when you call $c->component('YourComponent').

This role will add the following method to your consuming class.

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 the "stash" for an instance of the requested component and return that or, if the value is not found, the value returned by "build_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.

Moose, Moose::Role, Catalyst::Component

Guillermo Roditi (groditi) <groditi@cpan.org>

You may distribute this code under the same terms as Perl itself.
2007-06-07 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.