1 package Catalyst::Action::Serialize::YAML::HTML;
4 use namespace::autoclean;
6 extends 'Catalyst::Action';
14 my ( $controller, $c ) = @_;
17 $controller->{'serialize'} ?
18 $controller->{'serialize'}->{'stash_key'} :
19 $controller->{'stash_key'}
21 my $app = $c->config->{'name'} || '';
22 my $output = "<html>";
23 $output .= "<title>" . $app . "</title>";
24 $output .= "<body><pre>";
25 my $text = HTML::Entities::encode(Dump($c->stash->{$stash_key}));
26 # Straight from URI::Find
27 my $finder = URI::Find->new(
29 my($uri, $orig_uri) = @_;
32 $newuri = $uri . "&content-type=text/html";
34 $newuri = $uri . "?content-type=text/html";
36 return qq|<a href="$newuri">$orig_uri</a>|;
38 $finder->find(\$text);
43 $c->response->output( $output );
47 __PACKAGE__->meta->make_immutable;