/[Frey]/branches/zimbardo/lib/Frey/Web.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /branches/zimbardo/lib/Frey/Web.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 653 by dpavlin, Sun Nov 30 23:49:32 2008 UTC revision 671 by dpavlin, Tue Dec 2 01:31:32 2008 UTC
# Line 225  sub page { Line 225  sub page {
225          if ( ! $body ) {          if ( ! $body ) {
226                  my $run = $a->{run} || 'as_markup';                  my $run = $a->{run} || 'as_markup';
227                  warn "# no body, invoke $self->$run on ", ref($self);                  warn "# no body, invoke $self->$run on ", ref($self);
228                  $body = $self->$run;                  eval {
229                            $body = $self->$run;
230                    };
231                    $body
232                            = $self->error( $@ )
233                            . $self->dropdown( self => $self )
234                            if $@;
235          }          }
236          if ( $self->content_type !~ m{html} ) {          if ( $self->content_type !~ m{html} ) {
237                  warn "# return only $self body ", $self->content_type;                  warn "# return only $self body ", $self->content_type;
# Line 314  sub editor_links { Line 320  sub editor_links {
320    
321  #       $error =~ s[(bless\({\s+.+?\s+},\s+)("[^"]+")(\) at)][<span class="frey-dropdown">$1<code>$2</code>$3</span>]gs; # FIXME insert bless hiding back  #       $error =~ s[(bless\({\s+.+?\s+},\s+)("[^"]+")(\) at)][<span class="frey-dropdown">$1<code>$2</code>$3</span>]gs; # FIXME insert bless hiding back
322    
323            # perl's backtrace
324          $error =~ s{at\s+(\S+)\s+line\s+(\d+)}          $error =~ s{at\s+(\S+)\s+line\s+(\d+)}
325                  {at <a target="editor" href="/editor+$1+$2">$1</a> line $2}gsm;                  {at <a target="editor" href="/editor+$1+$2">$1</a> line $2}gsm;
326    
327            # our backtrace
328          $error =~ s{(via (?:package) "?)([\w:]+)("?)}          $error =~ s{(via (?:package) "?)([\w:]+)("?)}
329                  {$1<a target="editor" href="/editor+$2+1">$2</a>$3}gsm;                  {$1<a target="editor" href="/editor+$2+1">$2</a>$3}gsm;
330    
331            # method error messages
332    #       $error =~ s{(method ")(\w+)"}
333    #               {$1<a target="/Frey::Shell::Grep?pattern=$2">$2</a>"}gsm; # FIXME replace with link to Frey::Introspect data
334    
335            # anything that looks like Class::Name=
336            $error =~ s{(\w+(?:::\w+)+)=}
337                    {<a target="$1" href="/$1">$1</a>=}gsm;
338    
339          return $error;          return $error;
340  }  }
341    
342    =head2 error
343    
344    This method will return error to browser and backtrace unless
345    error message ends with LF C<\n> just like L<warn>
346    
347    =cut
348    
349  sub error {  sub error {
350          my $self = shift;          my $self = shift;
351          my $error = join(" ", @_);          my $error = join(" ", @_);
352    
353          my @backtrace = $self->backtrace;          my $fatal = '';
354          $error .= "\n\t" . join( "\n\t", @backtrace ) if @backtrace;  
355            if ( $error !~ m{\n$} ) {
356                    if ( my @backtrace = $self->backtrace ) {
357                            $error .= "\n\t" . join( "\n\t", @backtrace );
358                            $fatal = qq| class="fatal"|;
359                    }
360            }
361    
362          warn "ERROR: $error\n";          warn "ERROR: $error\n";
363          return          return
364                  qq|<pre class="frey-error">|                  qq|<pre class="frey-error$fatal">|
365                  . $self->editor_links( $error ) .                  . $self->editor_links( $error ) .
366                  qq|</pre>|                  qq|</pre>|
367                  ;                  ;
# Line 461  my $multiline_markers = { Line 490  my $multiline_markers = {
490          '"' => '"',          '"' => '"',
491  };  };
492    
493    =for later
494    
495  my $multiline_re = '[\\' . join('\\', keys %$multiline_markers ) . ']';  my $multiline_re = '[\\' . join('\\', keys %$multiline_markers ) . ']';
496  warn "## multiline markers ", dump( $multiline_markers ), " -> $multiline_re";  warn "## multiline markers ", dump( $multiline_markers ), " -> $multiline_re";
497    
498    =cut
499    
500  sub log_path {  sub log_path {
501          $Frey::Bootstrap::log_path || die "no log_path?";          $Frey::Bootstrap::log_path || die "no log_path?";
502  }  }

Legend:
Removed from v.653  
changed lines
  Added in v.671

  ViewVC Help
Powered by ViewVC 1.1.26