File: Headers.pm

package info (click to toggle)
libcatalyst-engine-apache-perl 1.12-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 700 kB
  • ctags: 498
  • sloc: perl: 6,003; makefile: 45
file content (33 lines) | stat: -rw-r--r-- 752 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package Catalyst::Plugin::Test::Headers;

use strict;

sub prepare {
    my $class = shift;

    my $c = $class->NEXT::prepare(@_);

    $c->response->header( 'X-Catalyst-Engine' => $c->engine );
    $c->response->header( 'X-Catalyst-Debug' => $c->debug ? 1 : 0 );
    
    {
        my $components = join( ', ', sort keys %{ $c->components } );
        $c->response->header( 'X-Catalyst-Components' => $components );
    }

    {
        no strict 'refs';
        my $plugins = join ', ', $class->registered_plugins;
        $c->response->header( 'X-Catalyst-Plugins' => $plugins );
    }

    return $c;
}

sub prepare_action {
    my $c = shift;
    $c->NEXT::prepare_action(@_);
    $c->res->header( 'X-Catalyst-Action' => $c->req->action );
}

1;