Refactor capturing of $app from ::Controller into ::Component::Role::CaptureApp for...
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Component / Role / CaptureApp.pm
1 package Catalyst::Component::Role::CaptureApp;
2
3 use Moose::Role;
4 use namespace::clean -except => 'meta';
5
6 # Future - isa => 'ClassName|Catalyst' performance?
7 #           required => 1 breaks tests..
8 has _application => (is => 'ro');
9 sub _app { (shift)->_application(@_) }
10
11 override BUILDARGS => sub {
12     my ($self, $app) = @_;
13
14     my $args = super();
15     $args->{_application} = $app;
16
17     return $args;
18 };
19
20 1;