File: Headers.pm

package info (click to toggle)
libcatalyst-perl 5.90132-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,016 kB
  • sloc: perl: 11,061; makefile: 7
file content (34 lines) | stat: -rw-r--r-- 756 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
34
package Catalyst::Plugin::Test::Headers;

use strict;
use MRO::Compat;

sub prepare {
    my $class = shift;

    my $c = $class->next::method(@_);

    $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::method(@_);
    $c->res->header( 'X-Catalyst-Action' => $c->req->action );
}

1;