package CGI::Carp::DebugScreen::DefaultView; use strict; use warnings; our $VERSION = '0.15'; sub as_html { my ($pkg, %options) = @_; delete $options{debug_template}; delete $options{error_template}; $options{debug} ? $pkg->_debug(%options) : $pkg->_error(%options); } sub _escape { my $str = shift; $str =~ s/&/&/g; $str =~ s/>/>/g; $str =~ s/ [top] [stacktraces] EOT if (@{ $options{watchlist} }) { $html .=<<"EOT"; [watchlist] EOT } if (@{ $options{modules} }) { $html .=<<"EOT"; [modules] EOT } if (@{ $options{environment} }) { $html .=<<"EOT"; [environment] EOT } $html .=<<"EOT"; EOT return $html; } sub _debug { my ($pkg, %options) = @_; my $error_at = _escape($options{error_at}); my $html =<<"EOT"; Debug Screen $options{style}

$error_at

EOT if ($options{show_raw_error}) { $html .=<<"EOT";
$options{raw_error}
EOT } else { $html .=<<"EOT";
$options{error_message}
EOT } $html .= _navi(%options); $html .=<<"EOT";

Stacktraces

EOT if (@{ $options{watchlist} }) { $html .= _navi(%options); $html .=<<"EOT";

Watch List

EOT } if (@{ $options{modules} }) { $html .= _navi(%options); $html .=<<"EOT";

Included Modules

EOT } if (@{ $options{environment} }) { $html .= _navi(%options); $html .=<<"EOT";

Environmental Variables

EOT foreach my $env (@{ $options{environment} }) { my $key = _escape($env->{key}); my $value = _escape($env->{value}); $html .=<<"EOT"; EOT } $html .=<<"EOT";
$key
$value
EOT } my $version = _escape($options{version}); my $view = _escape($options{view}); $html .=<<"EOT";
EOT return $html; } sub _error { my ($pkg, %options) = @_; my %escaped = map { ( $_, _escape($options{$_}) ) } keys %options; my $html =<<"EOT"; An unexpected error has been detected $options{style}

An unexpected error has been detected

Sorry for inconvenience.

EOT return $html; } 1; __END__ =head1 NAME CGI::Carp::DebugScreen::DefaultView - CGI::Carp::DebugScreen Renderer without template engines =head1 SYNOPSIS use CGI::Carp::DebugScreen ( engine => 'DefaultView', # CGI::Carp::DebugScreen::DefaultView # will be called internally; you can # omit this. ); =head1 DESCRIPTION One of the ready-made view (renderer) classes for L. Note that this doesn't support template overriding. =head1 METHOD =head2 as_html will be called internally from L. =head1 SEE ALSO L =head1 AUTHOR Kenichi Ishigaki, Eishigaki@cpan.orgE =head1 COPYRIGHT AND LICENSE Copyright (C) 2005-2006 by Kenichi Ishigaki This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut