1 package Catalyst::Component::ApplicationAttribute;
4 use namespace::clean -except => 'meta';
6 # Future - isa => 'ClassName|Catalyst' performance?
7 # required => 1 breaks tests..
8 has _application => (is => 'ro', weak_ref => 1);
9 sub _app { (shift)->_application(@_) }
11 override BUILDARGS => sub {
12 my ($self, $app) = @_;
15 $args->{_application} = $app;
26 Catalyst::Component::ApplicationAttribute - Moose Role for components which capture the application context.
30 package My::Component;
32 extends 'Catalyst::Component';
33 with 'Catalyst::Component::ApplicationAttribute';
41 This role provides a BUILDARGS method which captures the application context into an attribute.
47 Weak reference to the application context.
51 =head2 BUILDARGS ($self, $app)
53 BUILDARGS method captures the application context into the C<_application> attribute.
57 Reader method for the application context.
61 L<Catalyst::Component>,
62 L<Catalyst::Controller>.
66 Catalyst Contributors, see Catalyst.pm
70 This program is free software, you can redistribute it and/or modify it under
71 the same terms as Perl itself.