Cosmetic: removed trailing whitespace
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Component / ApplicationAttribute.pm
CommitLineData
c1ec627e 1package Catalyst::Component::ApplicationAttribute;
9cc543bc 2
3use Moose::Role;
4use namespace::clean -except => 'meta';
5
6# Future - isa => 'ClassName|Catalyst' performance?
7# required => 1 breaks tests..
8d4ef431 8has _application => (is => 'ro', weak_ref => 1);
9cc543bc 9sub _app { (shift)->_application(@_) }
10
11override BUILDARGS => sub {
12 my ($self, $app) = @_;
13
14 my $args = super();
15 $args->{_application} = $app;
16
17 return $args;
18};
19
201;
1a23d3da 21
22__END__
23
24=head1 NAME
25
26Catalyst::Component::ApplicationAttribute - Moose Role for components which capture the application context.
27
28=head1 SYNOPSIS
29
30 package My::Component;
31 use Moose;
32 extends 'Catalyst::Component';
33 with 'Catalyst::Component::ApplicationAttribute';
b0ad47c1 34
1a23d3da 35 # Your code here
b0ad47c1 36
1a23d3da 37 1;
38
39=head1 DESCRIPTION
40
41This role provides a BUILDARGS method which captures the application context into an attribute.
42
43=head1 ATTRIBUTES
44
45=head2 _application
46
47Weak reference to the application context.
48
49=head1 METHODS
50
51=head2 BUILDARGS ($self, $app)
52
53BUILDARGS method captures the application context into the C<_application> attribute.
54
55=head2 _application
56
57Reader method for the application context.
58
59=head1 SEE ALSO
60
61L<Catalyst::Component>,
62L<Catalyst::Controller>.
63
64=head1 AUTHORS
65
66Catalyst Contributors, see Catalyst.pm
67
68=head1 COPYRIGHT
69
536bee89 70This library is free software. You can redistribute it and/or modify it under
1a23d3da 71the same terms as Perl itself.
72
73=cut