/[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 457 by dpavlin, Wed Nov 19 16:53:13 2008 UTC revision 460 by dpavlin, Wed Nov 19 17:57:48 2008 UTC
# Line 168  sub page { Line 168  sub page {
168          my $url = $self->request_url;          my $url = $self->request_url;
169          $url =~ s{\?reload=\d+}{};          $url =~ s{\?reload=\d+}{};
170    
171          my $body = $a->{body} || $self->as_markup;          my $body = $a->{body};
172          return $body if $self->content_type !~ m{html};          $body ||= $self->as_markup if $self->can('as_markup');
173          $body ||= '<!-- no body -->';          if ( $self->content_type !~ m{html} ) {
174                    warn "# return only $self body ", $self->content_type;
175                    return $body
176            } elsif ( ! defined $body ) {
177                    warn "# no body";
178                    $body = '<!-- no body -->';
179            }
180    
181          my $html = join("\n",          my $html = join("\n",
182                  qq|<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"><html><head>|,                  qq|<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"><html><head>|,
# Line 198  sub page { Line 204  sub page {
204  sub error {  sub error {
205          my $self = shift;          my $self = shift;
206          my $error = join(" ", @_);          my $error = join(" ", @_);
207          my ($package, $filename, $line) = caller;  
208          $error .= " at $filename line $line" if $error !~ m{ at };          my @backtrace;
209          warn "WARN: $error\n";          foreach ( 0 .. 5 ) {
210                    my @caller = caller($_) or last;
211                    my @description = ( qw/
212                            package filename line
213                            subroutine hasargs
214                            wantarray evaltext is_require
215                            hints bitmask hinthash
216                    /);
217                    push @backtrace, join(' ',
218                            map {
219                                    $description[$_] . ': ' . dump $caller[$_]
220                            } ( 0 .. $#caller )
221                    );
222            }
223            if ( @backtrace ) {
224                    warn "# append backtrace: ", dump( @backtrace );
225                    $error .= "\n\t" . join( "\n\t", @backtrace );
226            }
227    
228            warn "ERROR: $error\n";
229          $error =~ s{at\s+(\S+)\s+line\s+(\d+)}{at <a target="editor" href="/editor+$1+$2">$1</a> line $2}gsm;          $error =~ s{at\s+(\S+)\s+line\s+(\d+)}{at <a target="editor" href="/editor+$1+$2">$1</a> line $2}gsm;
230          $error =~ s{(via package ")([\w:]+)(")}{$1<a target="editor" href="/editor+$2+1">$2</a>$3}gsm;          $error =~ s{(via package ")([\w:]+)(")}{$1<a target="editor" href="/editor+$2+1">$2</a>$3}gsm;
231          return qq|<pre class="frey-error">$error</pre>|;          return qq|<pre class="frey-error">$error</pre>|;

Legend:
Removed from v.457  
changed lines
  Added in v.460

  ViewVC Help
Powered by ViewVC 1.1.26