package Catty;
use strict;
+use warnings;
#use Catalyst;
use Catalyst;
}
}
+sub redirect_with_500 : Global {
+ my ( $self, $c ) = @_;
+ $DB::single = 1;
+ $c->res->redirect( $c->uri_for("/bonjour"));
+ die "erk!";
+}
+
sub die : Global {
my ( $self, $context ) = @_;
my $html = html( "Die", "This is the die page" );
die "erk!";
}
+sub name : Global {
+ my ($self, $c) = @_;
+
+ my $html = html( $c->config->{name}, "This is the die page" );
+ $c->response->content_type("text/html");
+ $c->response->output($html);
+}
+
+sub host : Global {
+ my ($self, $c) = @_;
+
+ my $host = $c->req->header('Host') || "<undef>";
+ my $html = html( $c->config->{name}, "Host: $host" );
+ $c->response->content_type("text/html");
+ $c->response->output($html);
+}
+
sub html {
my ( $title, $body ) = @_;
return qq{
$c->response->headers->push_header( 'Vary', 'Accept-Encoding' );
}
+sub user_agent : Global {
+ my ( $self, $c ) = @_;
+
+ my $html = html($c->req->user_agent, $c->req->user_agent);
+ $c->response->content_type("text/html; charset=utf-8");
+ $c->response->output( $html );
+
+}
+
1;