Show
Ignore:
Timestamp:
11/22/08 03:26:31 (5 years ago)
Author:
charsbar
Message:

CGI-Carp-DebugScreen?: further refactoring; 0.15 -> CPAN

Location:
lang/perl/CGI-Carp-DebugScreen/trunk
Files:
1 added
8 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/CGI-Carp-DebugScreen/trunk/Changes

    r24376 r24589  
    11Revision history for CGI::Carp::DebugScreen 
    22 
    3 0.15  2008/11/** (not yet released but will be soon) 
    4   - major cosmetic changes 
    5   - now accepts any renderer with "as_html" method 
     30.15  2008/11/22 
     4  - major refactoring; internals are changed a lot 
     5  - now accepts any engine/view with "as_html" method 
    66  - some of the name of the options are changed and 
    77    waiting for deprecation. If you have used a custom 
    8     renderer, see the sources and find "XXX"s. 
     8    view, see the sources and find "XXX"s. 
     9  - added some tests 
    910 
    10110.14  2007/05/27 
  • lang/perl/CGI-Carp-DebugScreen/trunk/MANIFEST

    r24376 r24589  
    99README 
    1010t/00_load.t 
     11t/10_view.t 
    1112t/20_dumper.t 
    1213t/99_pod.t 
  • lang/perl/CGI-Carp-DebugScreen/trunk/README

    r24382 r24589  
    44CGI::Carp::DebugScreen provides decent debug/error screens for Web 
    55applications via CGI::Carp's set_message() function. You don't need 
    6 to care $SIG{__DIE__} anymore. Just die or croak to get the right 
     6to care $SIG{__DIE__} anymore. Just die or croak to get the right  
    77thing. You can customize those screens as well. 
    88 
     
    2222  CGI::Carp 
    2323 
    24 COPYRIGHT AND LICENSE 
     24COPYRIGHT AND LICENCE 
    2525 
    26 Copyright (C) 2005-2008 by Kenichi Ishigaki 
     26Copyright (C) 2005-2006 by Kenichi Ishigaki 
    2727 
    2828This library is free software; you can redistribute it and/or modify 
  • lang/perl/CGI-Carp-DebugScreen/trunk/lib/CGI/Carp/DebugScreen.pm

    r24382 r24589  
    1111  my $MyDebug = 0; 
    1212  CGI::Carp::set_message( 
    13     sub { __PACKAGE__->_show(@_) } 
     13    sub { __PACKAGE__->_output(@_) } 
    1414  ) unless $MyDebug; 
    1515} 
     
    1717$Carp::Verbose = 1;   # for stacktraces 
    1818 
    19 my $Debug  = 1; 
    20 my $Engine = 'DefaultView'; 
    21 my $ShowLines = 3; 
    22 my $ShowMod; 
    23 my $ShowEnv; 
    24 my $ShowRawError; 
    25 my $IgnoreOverload; 
    26 my $DebugTemplate; 
    27 my $ErrorTemplate; 
    28 my $WatchList = {}; 
    29  
    30 my $Style =<<'EOS'; 
     19sub _default_stylesheet { 
     20  return <<'EOS'; 
    3121<style type="text/css"> 
    3222<!-- 
     
    3626    color: #000; 
    3727    background-color: #f60; 
    38     margin: 0; 
    39     padding: 0; 
     28    margin: 0px; 
     29    padding: 0px; 
    4030  } 
    4131  :link, :link:hover, :visited, :visited:hover { 
     
    7666    font-size: .8em; 
    7767    line-height: 120%; 
    78     font-family: "Courier New", Courier, monospace; 
     68    font-family: 'Courier New', Courier, monospace; 
    7969    background-color: #fc9; 
    8070    color: #333; 
     
    9585  table.code td.num { 
    9686    width: 4em; 
    97     text-align: right; 
     87    text-align:right 
    9888  } 
    9989  table.watch { 
     
    124114    font-size: .8em; 
    125115    line-height: 120%; 
    126     font-family: "Courier New", Courier, monospace; 
     116    font-family: 'Courier New', Courier, monospace; 
    127117    overflow: auto; 
    128118  } 
     
    137127    margin: 0 1em; 
    138128    font-size: .8em; 
    139     text-align: right; 
    140   } 
    141  
     129    text-align:right; 
     130  } 
    142131--> 
    143132</style> 
    144133EOS 
     134} 
     135 
     136my %Options; 
     137my %Mapping = ( 
     138  debug           => qr/^d(?:ebug)?$/, 
     139  engine          => qr/^e(?:ngine)?$/, 
     140  show_lines      => qr/^l(?:ines)?$/, 
     141  show_mod        => qr/^m(?:od(?:ules)?)?$/, 
     142  show_env        => qr/^env(?:ironment)?$/, 
     143  show_raw_error  => qr/^raw(?:_error)?$/, 
     144  ignore_overload => qr/^(?:ignore_)?overload$/, 
     145  debug_template  => qr/^d(?:ebug_)?t(?:emplate)?$/, 
     146  error_template  => qr/^e(?:rror_)?t(?:emplate)?$/, 
     147  style           => qr/^s(?:tyle)?$/, 
     148); 
    145149 
    146150sub import { 
    147   my $pkg = shift; 
    148   my %options = @_; 
     151  my ($class, %options) = @_; 
     152 
     153  %Options = ( 
     154    debug           => 1, 
     155    engine          => 'DefaultView', 
     156    show_lines      => 3, 
     157    show_mod        => 0, 
     158    show_env        => 0, 
     159    show_raw_error  => 0, 
     160    ignore_overload => 0, 
     161    debug_template  => '', 
     162    error_template  => '', 
     163    style           => _default_stylesheet(), 
     164    watchlist       => {}, 
     165  ); 
    149166 
    150167  while(my ($key, $value) = each %options) { 
    151168    next unless defined $value; 
    152     $key = lc $key; 
    153     $Debug          = $value if $key =~ /^d(?:ebug)?$/; 
    154     $Engine         = $value if $key =~ /^e(?:ngine)?$/; 
    155     $ShowLines      = $value if $key =~ /^l(?:ines)?$/; 
    156     $ShowMod        = $value if $key =~ /^m(?:od(?:ules)?)?$/; 
    157     $ShowEnv        = $value if $key =~ /^env(?:ironment)?$/; 
    158     $ShowRawError   = $value if $key =~ /^raw(?:_error)?$/; 
    159     $IgnoreOverload = $value if $key =~ /^(?:ignore_)?overload$/; 
    160     $DebugTemplate  = $value if $key =~ /^d(?:ebug_)?t(?:emplate)?$/; 
    161     $ErrorTemplate  = $value if $key =~ /^e(?:rror_)?t(?:emplate)?$/; 
    162     $Style          = $value if $key =~ /^s(?:tyle)?$/; 
    163   } 
    164 } 
    165  
    166 sub debug              { shift; $Debug = shift; } 
    167 sub set_debug_template { shift; $DebugTemplate = shift; } 
    168 sub set_error_template { shift; $ErrorTemplate = shift; } 
    169 sub set_style          { shift; $Style = shift; } 
    170 sub show_modules       { shift; $ShowMod = shift; } 
    171 sub show_environment   { shift; $ShowEnv = shift; } 
    172 sub show_raw_error     { shift; $ShowRawError = shift; } 
    173 sub ignore_overload    { shift; $IgnoreOverload = shift; } 
     169    foreach my $canonkey ( keys %Mapping ) { 
     170      if ( $key =~ $Mapping{$canonkey} ) { 
     171        $Options{$canonkey} = $value; 
     172        last; 
     173      } 
     174    } 
     175  } 
     176} 
     177 
     178sub debug              { shift; $Options{debug}           = shift; } 
     179sub set_debug_template { shift; $Options{debug_template}  = shift; } 
     180sub set_error_template { shift; $Options{error_template}  = shift; } 
     181sub set_style          { shift; $Options{style}           = shift; } 
     182sub show_modules       { shift; $Options{show_mod}        = shift; } 
     183sub show_environment   { shift; $Options{show_env}        = shift; } 
     184sub show_raw_error     { shift; $Options{show_raw_error}  = shift; } 
     185sub ignore_overload    { shift; $Options{ignore_overload} = shift; } 
    174186 
    175187sub add_watchlist      { 
    176   my ($pkg, %hash) = @_; 
     188  my ($class, %hash) = @_; 
    177189  foreach my $key (keys %hash) { 
    178     $WatchList->{$key} = $hash{$key}; 
    179   } 
    180 } 
    181  
    182 sub _show { 
    183   my ($pkg, $raw_error) = @_; 
     190    $Options{watchlist}->{$key} = $hash{$key}; 
     191  } 
     192} 
     193 
     194sub _get_stacktraces { 
     195  my ($class, $raw_error) = @_; 
    184196 
    185197  my $first_message = ''; 
    186198  my $no_more_first; 
     199 
    187200  my @stacktraces = grep { 
    188       my $caller = $_->{caller} || ''; 
    189       ( 
    190         $caller eq '' or                  # ignore undefined caller; 
    191         $caller eq $INC{'Carp.pm'} or     # ignore Carp; 
    192         $caller eq $INC{'CGI/Carp.pm'}    # ignore CGI::Carp; 
    193       ) ? 0 : 1; 
    194     } 
    195     map { 
    196       my $line = $_; 
    197       my ($message, $caller, $line_no) = $line =~ /^(?:\s*)(.*?)(?: called)? at (\S+) line (.+)$/; 
    198       $first_message .= "$line<br>" if !defined $message && !$no_more_first; 
    199       $no_more_first = 1 if defined $message; 
    200       $first_message = $message unless $first_message; 
    201       $caller  ||= ''; 
    202       $line_no ||= 0; 
    203       my $context = _get_context($caller, $line_no); 
    204       +{ 
    205          message  => $message, 
    206          caller   => $caller, 
    207          line     => $line_no, 
    208          context  => $context, 
    209  
    210          # XXX: will be deprecated next time 
    211          contents => $context, 
    212        } 
    213     } split(/\n/, $raw_error); 
    214  
    215   my $error_at = $stacktraces[$#stacktraces]->{caller}; 
    216  
    217   my @modules = (); 
    218   @modules = map { 
     201    my $caller = $_->{caller} || ''; 
     202    ( 
     203      $caller eq '' or                  # ignore undefined caller; 
     204      $caller eq $INC{'Carp.pm'} or     # ignore Carp; 
     205      $caller eq $INC{'CGI/Carp.pm'}    # ignore CGI::Carp; 
     206    ) ? 0 : 1; 
     207  } 
     208  map { 
     209    my $line = $_; 
     210    my ($message, $caller, $line_no) = $line =~ /^(?:\s*)(.*?)(?: called)? at (\S+) line (.+)$/; 
     211    $first_message .= "$line<br>" if !defined $message && !$no_more_first; 
     212    $no_more_first = 1 if defined $message; 
     213    $first_message = $message unless $first_message; 
     214    $caller  ||= ''; 
     215    $line_no ||= 0; 
     216    my $context = $class->_get_context($caller, $line_no); 
     217    +{ 
     218       message  => $message, 
     219       caller   => $caller, 
     220       line     => $line_no, 
     221       context  => $context, 
     222 
     223       # XXX: will be deprecated next time 
     224       contents => $context, 
     225    }; 
     226  } split(/\n/, $raw_error); 
     227 
     228  my $error_at      = $stacktraces[$#stacktraces]->{caller}; 
     229  my $error_message = $first_message.' at '.$stacktraces[0]->{caller}.' line '.$stacktraces[0]->{line}; 
     230 
     231  return ( $error_at, $error_message, @stacktraces ); 
     232} 
     233 
     234sub _get_context { 
     235  my ($class, $file, $line_no) = @_; 
     236 
     237  return unless $file && -f $file; 
     238 
     239  my @context; 
     240  if (open my $fh, '<', $file) { 
     241    my $ct = 0; 
     242    while(my $line = <$fh>) { 
     243      $ct++; 
     244      next if $ct < $line_no - $Options{show_lines}; 
     245      last if $ct > $line_no + $Options{show_lines}; 
     246      push @context, { 
     247        no   => $ct, 
     248        line => $line, 
     249        hit  => ($ct == $line_no), 
     250      }; 
     251    } 
     252  } 
     253  \@context; 
     254} 
     255 
     256sub _get_modules { 
     257  my ($class, $flag) = @_; 
     258 
     259  return unless $flag; 
     260 
     261  return map { 
    219262    my $key = $_; 
    220263    (my $package = $key) =~ s|/|::|g; 
     
    223266      file    => $INC{$key}, 
    224267    } 
    225   } sort {$a cmp $b} keys %INC if $ShowMod; 
    226  
    227   my @environment = (); 
    228   @environment = map { 
     268  } sort {$a cmp $b} keys %INC; 
     269} 
     270 
     271sub _get_env { 
     272  my ($class, $flag) = @_; 
     273 
     274  return unless $flag; 
     275 
     276  return map { 
    229277    +{ 
    230278      key   => $_, 
    231279      value => $ENV{$_}, 
    232280    } 
    233   } sort {$a cmp $b} keys %ENV if $ShowEnv; 
    234  
    235   my @watchlist = (); 
    236   if (%{ $WatchList }) { 
     281  } sort {$a cmp $b} keys %ENV; 
     282} 
     283 
     284sub _get_watchlist { 
     285  my ($class, $href, $overload) = @_; 
     286 
     287  my @list; 
     288  if (%{ $href }) { 
    237289    require CGI::Carp::DebugScreen::Dumper; 
    238     CGI::Carp::DebugScreen::Dumper->ignore_overload($IgnoreOverload); 
    239     foreach my $key (sort {$a cmp $b} keys %{ $WatchList }) { 
    240       my $dump = CGI::Carp::DebugScreen::Dumper->dump( 
    241                    $WatchList->{$key} 
    242                  ); 
    243       push @watchlist, { 
     290    CGI::Carp::DebugScreen::Dumper->ignore_overload($overload); 
     291    foreach my $key (sort {$a cmp $b} keys %{ $href }) { 
     292      my $dump = CGI::Carp::DebugScreen::Dumper->dump($href->{$key}); 
     293      push @list, { 
    244294        key   => $key, 
    245295        value => $dump, 
     
    250300    } 
    251301  } 
    252  
    253   my ($renderer_class, $renderer); 
    254   if ( ref $Engine && $Engine->can('as_html') ) { 
    255     $renderer_class = ref $Engine; 
    256     $renderer = $Engine; 
     302  return @list; 
     303} 
     304 
     305sub _load_view { 
     306  my ($class, $engine) = @_; 
     307 
     308  my ($view_class, $view); 
     309  if ( ref $engine && $engine->can('as_html') ) { 
     310    $view_class = ref $engine; 
     311    $view       = $engine; 
    257312  } 
    258313  else { 
    259     $Engine = 'TT' if lc $Engine eq 'template'; # engine alias 
    260  
    261     $renderer_class = 
    262       ( $Engine =~ s/^\+// ) ? $Engine : __PACKAGE__.'::'.$Engine; 
    263  
    264     eval "require $renderer_class"; 
     314    # engine alias 
     315    $engine = 'TT' if lc $engine eq 'template'; 
     316 
     317    $view_class = ( $engine =~ s/^\+// ) ? $engine : __PACKAGE__.'::'.$engine; 
     318 
     319    eval "require $view_class"; 
    265320    if ($@) { 
    266321      require CGI::Carp::DebugScreen::DefaultView; 
    267       $renderer_class = 'CGI::Carp::DebugScreen::DefaultView'; 
    268     } 
    269     $renderer = $renderer_class; 
    270   } 
    271  
    272   my $error_message = $first_message.' at '.$stacktraces[0]->{caller}.' line '.$stacktraces[0]->{line}; 
    273  
    274   my $html = $renderer->as_html( 
     322      $view_class = 'CGI::Carp::DebugScreen::DefaultView'; 
     323    } 
     324    $view = $view_class; 
     325  } 
     326  return ( $view_class, $view ); 
     327} 
     328 
     329sub _render { 
     330  my ($class, $raw_error) = @_; 
     331 
     332  my ($error_at, $error_message, @stacktraces) = $class->_get_stacktraces($raw_error); 
     333 
     334  my @modules     = $class->_get_modules($Options{show_mod}); 
     335  my @environment = $class->_get_env($Options{show_env}); 
     336  my @watchlist   = $class->_get_watchlist( 
     337    $Options{watchlist}, 
     338    $Options{ignore_overload}, 
     339  ); 
     340 
     341  my ($view_class, $view) = $class->_load_view($Options{engine}); 
     342 
     343  return $view->as_html( 
    275344    version        => $VERSION, 
    276     debug          => $Debug, 
    277     debug_template => $DebugTemplate, 
    278     error_template => $ErrorTemplate, 
    279     renderer_class => $renderer_class, 
    280     style          => $Style, 
     345    debug          => $Options{debug}, 
     346    debug_template => $Options{debug_template}, 
     347    error_template => $Options{error_template}, 
     348    view           => $view_class, 
     349    style          => $Options{style}, 
    281350    error_at       => $error_at, 
    282351    error_message  => $error_message, 
    283352    raw_error      => $raw_error, 
    284     show_raw_error => $ShowRawError, 
     353    show_raw_error => $Options{show_raw_error}, 
    285354    stacktraces    => \@stacktraces, 
    286355    modules        => \@modules, 
     
    289358 
    290359    # XXX: will be deprecated next time 
    291     view           => $renderer_class, 
    292     debug_tmpl     => $DebugTemplate, 
    293     error_tmpl     => $ErrorTemplate, 
     360    debug_tmpl     => $Options{debug_template}, 
     361    error_tmpl     => $Options{error_template}, 
    294362    traces         => \@stacktraces, 
    295363  ); 
     364} 
     365 
     366sub _output { 
     367  my ($class, $raw_error) = @_; 
     368 
     369  my $html = $class->_render($raw_error); 
    296370 
    297371  # shamelessly stolen from CGI::Carp 
     
    329403} 
    330404 
    331 sub _get_context { 
    332   my ($file, $line_no) = @_; 
    333  
    334   return unless $file && -f $file; 
    335  
    336   my @context; 
    337   if (open my $fh, '<', $file) { 
    338     my $ct = 0; 
    339     while(my $line = <$fh>) { 
    340       $ct++; 
    341       next if $ct < $line_no - $ShowLines; 
    342       last if $ct > $line_no + $ShowLines; 
    343       push @context, { 
    344         no   => $ct, 
    345         line => $line, 
    346         hit  => ($ct == $line_no), 
    347       }; 
    348     } 
    349   } 
    350   \@context; 
    351 } 
    352  
    3534051; 
    354406 
     
    361413=head1 SYNOPSIS 
    362414 
     415  use strict; 
     416  use warnings; 
    363417  use Carp; 
    364   use CGI::Carp::DebugScreen ( 
    365     debug       => $ENV{Debug}, 
    366     engine      => 'HTML::Template', 
    367     lines       => 5, 
    368     modules     => 1, 
    369     environment => 1, 
    370     overload    => 1, 
    371     raw_error   => 0, 
    372   ); 
     418  use CGI::Carp::DebugScreen ( debug => $ENV{Debug} ); 
     419  use CGI; 
     420 
     421  my $query = CGI->new; 
    373422 
    374423  croak "let's see"; 
     
    376425=head1 DESCRIPTION 
    377426 
    378 CGI::Carp qw/fatalsToBrowser/ is very useful for debugging. But the error screen it provides is a bit too plain; something you don't want to see, and you don't want your boss and colleagues and users to see. You might know CGI::Carp has a wonderful set_message() function but, you don't want to repeat yourself, right? 
     427C<CGI::Carp qw/fatalsToBrowser/> is very useful for debugging. But the error screen it provides is a bit too plain; something you don't want to see, and you don't want your boss and colleagues and users to see. You might know CGI::Carp has a wonderful C<set_message()> function but, you don't want to repeat yourself, right? 
    379428 
    380429Hence this module. 
    381430 
    382 This module calls CGI::Carp qw/fatalsToBrowser/ and set_message() function internally. If something dies or croaks, this confesses stack traces, included modules (optional), environmental variables (optional, too) in a more decent way. 
     431This module calls C<CGI::Carp qw/fatalsToBrowser/> and C<set_message()> function internally. If something dies or croaks, this confesses stack traces, included modules (optional), environmental variables (optional, too) in a more decent way. 
    383432 
    384433When you finish debugging, set debug option to false (via some environmental variable, for example). Then, more limited, less informative error screen appears when dies or croaks. If something goes wrong and your users might see the screen, they only know something has happened. They'll never know where your modules are and they'll never see the awkward 500 Internal Server Error -- hopefully. 
     
    411460=head2 engine (or e) 
    412461 
    413 Sets the name of a rendering class. Default value is C<DefaultView>, which uses no template engines. C<HTML::Template> and C<TT> are also available. As of 0.15, you can pass any class with a prepending C<+> or any object with C<as_html> method, which should take a hash of options and returns an HTML string. Your rendering class/object doesn't need to use all of the options naturally. 
     462Sets the base name of a view class. Default value is C<DefaultView>, which uses no template engines. C<HTML::Template> and C<TT> are also available. As of 0.15, you can pass any class with a prepending C<+> or any object with C<as_html> method, which should take a hash of options and returns an HTML string. Your rendering class/object doesn't need to use all of the options naturally. 
    414463 
    415464The options are: 
     
    429478the ones you specified while loading (or via methods). 
    430479 
    431 =item renderer_class 
    432  
    433 the actual class name of the renderer. 
     480=item view_class 
     481 
     482the actual class name of the view (i.e. renderer). 
    434483 
    435484=item error_at, error_message 
     
    553602=head1 COPYRIGHT AND LICENSE 
    554603 
    555 Copyright (C) 2005-2008 by Kenichi Ishigaki 
    556  
    557 This library is free software; you can redistribute it and/or 
     604Copyright (C) 2005-2006 by Kenichi Ishigaki 
     605 
     606This library is free software; you can redistribute it and/or  
    558607modify it under the same terms as Perl itself. 
    559608 
  • lang/perl/CGI-Carp-DebugScreen/trunk/lib/CGI/Carp/DebugScreen/DefaultView.pm

    r24382 r24589  
    6262 
    6363  my $html =<<"EOT"; 
    64 <!DOCTYPE html> 
    6564<html> 
    6665<head> 
     
    9190  $html .=<<"EOT"; 
    9291<div class="box"> 
    93 <h2><a name="stacktraces">Stack Traces</a></h2> 
     92<h2><a name="stacktraces">Stacktraces</a></h2> 
    9493<ul id="stacktraces"> 
    9594EOT 
     
    145144      $html .=<<"EOT"; 
    146145<li> 
    147 <strong>$key</strong><br> 
     146<b>$key</b><br> 
    148147<div class="scrollable"> 
    149148$table 
     
    205204  } 
    206205 
    207   my $version  = _escape($options{version}); 
    208   my $renderer = _escape($options{renderer_class}); 
    209  
    210   $html .=<<"EOT"; 
    211 <p class="footer">CGI::Carp::DebugScreen $version. Output via $renderer</p> 
     206  my $version = _escape($options{version}); 
     207  my $view    = _escape($options{view}); 
     208 
     209  $html .=<<"EOT"; 
     210<p class="footer">CGI::Carp::DebugScreen $version. Output via $view</p> 
    212211</div> 
    213212</body> 
     
    226225 
    227226  my $html =<<"EOT"; 
    228 <!DOCTYPE html> 
    229227<html> 
    230228<head> 
     
    235233<div id="page"> 
    236234<h1>An unexpected error has been detected</h1> 
    237 <p>Sorry for the inconvenience.</p> 
     235<p>Sorry for inconvenience.</p> 
    238236</div> 
    239237</body> 
     
    262260=head1 DESCRIPTION 
    263261 
    264 One of the ready-made renderers for L<CGI::Carp::DebugScreen>. 
     262One of the ready-made view (renderer) classes for L<CGI::Carp::DebugScreen>. 
    265263 
    266264Note that this doesn't support template overriding. 
     
    282280=head1 COPYRIGHT AND LICENSE 
    283281 
    284 Copyright (C) 2005-2008 by Kenichi Ishigaki 
     282Copyright (C) 2005-2006 by Kenichi Ishigaki 
    285283 
    286284This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. 
  • lang/perl/CGI-Carp-DebugScreen/trunk/lib/CGI/Carp/DebugScreen/Dumper.pm

    r24382 r24589  
    134134=head1 TODO 
    135135 
    136 I'm afraid that this module should have another (and shorter) name and stand alone. The dumps() method should take array, hash, or multiple variables. 
     136I'm afraid that this module should have another (and shorter) name and stand alone. The dumps() method should take array, hash, or multiple variables.  
    137137 
    138138=head1 SEE ALSO 
     
    146146=head1 COPYRIGHT AND LICENSE 
    147147 
    148 Copyright (C) 2006-2008 by Kenichi Ishigaki 
     148Copyright (C) 2006 by Kenichi Ishigaki 
    149149 
    150150This library is free software; you can redistribute it and/or modify it 
  • lang/perl/CGI-Carp-DebugScreen/trunk/lib/CGI/Carp/DebugScreen/HTML/Template.pm

    r24382 r24589  
    88 
    99my $DebugTemplate =<<'EOT'; 
    10 <!DOCTYPE html> 
    1110<html> 
    1211<head> 
     
    2928<div class="navi">[<a href="#top">top</a>] [<a href="#stacktraces">stacktraces</a>]<TMPL_IF NAME="watchlist"> [<a href="#watch">watchlist</a>]</TMPL_IF><TMPL_IF NAME="modules"> [<a href="#modules">modules</a>]</TMPL_IF><TMPL_IF NAME="environment"> [<a href="#environment">environment</a>]</TMPL_IF></div> 
    3029<div class="box"> 
    31 <h2><a name="stacktraces">Stack Traces</a></h2> 
     30<h2><a name="stacktraces">Stacktraces</a></h2> 
    3231<ul id="stacktraces"> 
    3332<TMPL_LOOP NAME="stacktraces"> 
     
    5049<TMPL_LOOP NAME="watchlist"> 
    5150<li> 
    52 <strong><TMPL_VAR NAME="key" ESCAPE=HTML></strong> 
     51<b><TMPL_VAR NAME="key" ESCAPE=HTML></b> 
    5352<div class="scrollable"> 
    5453<TMPL_VAR NAME="value"> 
     
    8382</div> 
    8483</TMPL_IF> 
    85 <p class="footer">CGI::Carp::DebugScreen <TMPL_VAR NAME="version" ESCAPE=HTML>. Output via <TMPL_VAR NAME="renderer_class" ESCAPE=HTML></p> 
     84<p class="footer">CGI::Carp::DebugScreen <TMPL_VAR NAME="version" ESCAPE=HTML>. Output via <TMPL_VAR NAME="view" ESCAPE=HTML></p> 
    8685</div> 
    8786</body> 
     
    9089 
    9190my $ErrorTemplate =<<'EOT'; 
    92 <!DOCTYPE html> 
    9391<html> 
    9492<head> 
     
    10199<div id="page"> 
    102100<h1>An unexpected error has been detected</h1> 
    103 <p>Sorry for the inconvenience.</p> 
     101<p>Sorry for inconvenience.</p> 
    104102</div> 
    105103</body> 
     
    142140=head1 DESCRIPTION 
    143141 
    144 One of the ready-made renderers for L<CGI::Carp::DebugScreen>. 
     142One of the ready-made view (renderer) classes for L<CGI::Carp::DebugScreen>. 
    145143 
    146144=head1 METHOD 
     
    160158=head1 COPYRIGHT AND LICENSE 
    161159 
    162 Copyright (C) 2005-2008 by Kenichi Ishigaki 
     160Copyright (C) 2005-2006 by Kenichi Ishigaki 
    163161 
    164162This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. 
  • lang/perl/CGI-Carp-DebugScreen/trunk/lib/CGI/Carp/DebugScreen/TT.pm

    r24382 r24589  
    88 
    99my $DebugTemplate =<<'EOT'; 
    10 <!DOCTYPE html> 
    1110<html> 
    1211<head> 
     
    4443[%- INCLUDE navi %] 
    4544<div class="box"> 
    46 <h2><a name="stacktraces">Stack Traces</a></h2> 
     45<h2><a name="stacktraces">Stacktraces</a></h2> 
    4746<ul id="stacktraces"> 
    4847[%- FOREACH stacktrace = stacktraces %] 
     
    6564[%- FOREACH watch = watchlist %] 
    6665<li> 
    67 <strong>[% watch.key | html %]</strong> 
     66<b>[% watch.key | html %]</b> 
    6867<div class="scrollable"> 
    6968[%- watch.value %] 
     
    9897</div> 
    9998[%- END %] 
    100 <p class="footer">CGI::Carp::DebugScreen [% version %]. Output via [% renderer_class %]</p> 
     99<p class="footer">CGI::Carp::DebugScreen [% version %]. Output via [% view %]</p> 
    101100</div> 
    102101</body> 
     
    105104 
    106105my $ErrorTemplate =<<'EOT'; 
    107 <!DOCTYPE html> 
    108106<html> 
    109107<head> 
     
    116114<div id="page"> 
    117115<h1>An unexpected error has been detected</h1> 
    118 <p>Sorry for the inconvenience.</p> 
     116<p>Sorry for inconvenience.</p> 
    119117</div> 
    120118</body> 
     
    167165=head1 DESCRIPTION 
    168166 
    169 One of the ready-made renderers for L<CGI::Carp::DebugScreen>. 
     167One of the ready-made view (renderer) classes for L<CGI::Carp::DebugScreen>. 
    170168 
    171169=head1 METHOD 
     
    185183=head1 COPYRIGHT AND LICENSE 
    186184 
    187 Copyright (C) 2005-2008 by Kenichi Ishigaki 
     185Copyright (C) 2005-2006 by Kenichi Ishigaki 
    188186 
    189187This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.