| Catalyst-Runtime documentation | Contained in the Catalyst-Runtime distribution. |
Catalyst::Component::ApplicationAttribute - Moose Role for components which capture the application context.
package My::Component;
use Moose;
extends 'Catalyst::Component';
with 'Catalyst::Component::ApplicationAttribute';
# Your code here
1;
This role provides a BUILDARGS method which captures the application context into an attribute.
Weak reference to the application context.
BUILDARGS method captures the application context into the _application attribute.
Reader method for the application context.
Catalyst Contributors, see Catalyst.pm
This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.
| Catalyst-Runtime documentation | Contained in the Catalyst-Runtime distribution. |
package Catalyst::Component::ApplicationAttribute; use Moose::Role; use namespace::clean -except => 'meta'; # Future - isa => 'ClassName|Catalyst' performance? # required => 1 breaks tests.. has _application => (is => 'ro', weak_ref => 1); sub _app { (shift)->_application(@_) } override BUILDARGS => sub { my ($self, $app) = @_; my $args = super(); $args->{_application} = $app; return $args; }; 1; __END__