1 package TestApp::Context;
3 extends 'Catalyst::Context';
4 with 'Catalyst::TraitFor::Context::TestHeaders';
5 with 'Catalyst::TraitFor::Context::TestErrors';
7 if (eval { Class::MOP::load_class('CatalystX::LeakChecker'); 1 }) {
8 with 'CatalystX::LeakChecker';
12 default => sub { [] },
17 my ($ctx, @leaks) = @_;
18 push @{ $ctx->leaks }, @leaks;
23 return scalar @{ $ctx->leaks };
28 my $class = ref( $c->component( $_[0] ) ) || $_[0];
29 my $action = $_[1]->reverse;
33 if ( $action =~ /->(\w+)$/ ) {
36 elsif ( $action =~ /\/(\w+)$/ ) {
39 elsif ( $action =~ /^(\w+)$/ ) {
43 if ( $class && $method && $method !~ /^_/ ) {
44 my $executed = sprintf( "%s->%s", $class, $method );
45 my @executed = $c->response->headers->header('X-Catalyst-Executed');
46 push @executed, $executed;
47 $c->response->headers->header(
48 'X-Catalyst-Executed' => join ', ',
52 no warnings 'recursion';
53 return $c->SUPER::execute(@_);