Ark

 view release on metacpan or  search on metacpan

lib/Ark/Context/Debug.pm  view on Meta::CPAN

package Ark::Context::Debug;
use Mouse::Role;

use Try::Tiny;
use HTML::Escape ();

has debug_report => (
    is      => 'rw',
    isa     => 'Text::SimpleTable',
    lazy    => 1,
    default => sub {
        my $self = shift;
        $self->ensure_class_loaded('Text::SimpleTable');
        Text::SimpleTable->new([62, 'Action'], [9, 'Time']);
    },
);

has debug_report_stack => (
    is      => 'rw',
    isa     => 'ArrayRef',
    lazy    => 1,
    default => sub { [] },
);

has debug_stack_traces => (
    is      => 'rw',
    isa     => 'ArrayRef',
    lazy    => 1,
    default => sub { [] },
);

has debug_screen_tamplate => (
    is      => 'rw',
    isa     => 'CodeRef',
    lazy    => 1,
    default => sub {
        my $self = shift;
        $self->ensure_class_loaded('Text::MicroTemplate');
        Text::MicroTemplate::build_mt(<<'__EOF__');
? sub encoded_string { goto &Text::MicroTemplate::encoded_string }
<?= encoded_string(qq[<\?xml version="1.0" encoding="utf-8"?\>\n]) ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>500 Internal Server Error</title>
<style type="text/css">
* {
  margin: 0;
  padding: 0;
  font-family: Verdana, Arial, sans-serif;
  font-size: 100%;
}

pre {
  padding: 5px;
  overflow: auto;
}
code {
  font-family: Monaco, 'Courier New', monospace;
}

pre code {
  width: 100%;
}

body {
  font-size: 76%;
  background-color: #ccc;
}

#container {
  margin: 0 100px;
  padding: 30px;
  border-right: 1px solid;
  border-left: 1px solid;
  background-color: #fefefe;
}

h1 {
  color: #f00;
  font-size: 2em;
}

h2 {
  color: #006088;
  margin-top: 20px;
  font-size: 1.8em;
}

#error {
  padding: 10px;
  color: #f00;
  font-weight: bold;
  border: 1px solid #f00;
  background-color: #fee;
}

.dump pre {
  border: 1px solid #333;
  background-color: #ddd;
  width: 100%;
  overflow: auto;
  padding: 0px;



( run in 2.664 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )