File: Plugin.pm

package info (click to toggle)
libcatalyst-engine-apache-perl 1.16-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,044 kB
  • sloc: perl: 6,344; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 767 bytes parent folder | download | duplicates (6)
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
35
package Catalyst::Plugin::Test::Plugin;

use strict;
use warnings;
use MRO::Compat;

use base qw/Class::Data::Inheritable/;

 __PACKAGE__->mk_classdata('ran_setup');

sub setup {
   my $c = shift;
   $c->ran_setup('1');
}

sub prepare {
    my $class = shift;

    my $c = $class->next::method(@_);
    $c->response->header( 'X-Catalyst-Plugin-Setup' => $c->ran_setup );

    return $c;
}

# Note: Catalyst::Plugin::Server forces the body to
#       be parsed, by calling the $c->req->body method in prepare_action.
#       We need to test this, as this was broken by 5.80. See also
#       t/aggregate/live_engine_request_body.t.
sub prepare_action {
    my $c = shift;
    $c->res->header('X-Have-Request-Body', 1) if $c->req->body;
    $c->next::method(@_);
}

1;