WebDyne Error !{! $_[1]->{'r'}->status !}


!{! \&HTTP::Status::status_message($_[1]->{'r'}->status) !}

# Need WebDyne Constants # use WebDyne::Constant; # Get self ref, extract supplied params # my ($self, $param_hr)=@_; # Local vars used across all routines # my $errstr=$param_hr->{'errstr'}; my @erreval=@{$param_hr->{'erreval_ar'}}; my @errstack=@{$param_hr->{'errstack_ar'}}; my $errtrace_ar=pop @errstack; # Get data block from paramaters and load line numbers and other params # my $data_ar=$param_hr->{'data_ar'}; my ($html_line_no_tag_start, $html_line_no_tag_end)=$self->data_ar_html_line_no($data_ar); my $inline=$data_ar->[$WEBDYNE_NODE_ATTR_IX] && $data_ar->[$WEBDYNE_NODE_ATTR_IX]->{'inline'}; # Expand eval array to components - only done if eval error # my ($eval_text_sr, $embedded, $eval_line_no)=@erreval[ $WEBDYNE_ERROR_EVAL_TEXT_IX, $WEBDYNE_ERROR_EVAL_EMBEDDED_IX, $WEBDYNE_ERROR_EVAL_LINE_NO_IX ]; # Source file name and tag start/finish line numbers for this error # my $srce_fn=$self->data_ar_html_srce_fn($data_ar); my $srce_fn_display=$srce_fn if $WEBDYNE_ERROR_SOURCE_FILENAME_SHOW; # Try to get line number of eval error from error string if not given explicitely, otherwise try # grovelling around in the error stack. # unless ($eval_line_no) { if ($errstr=~/\(eval \d+\) line (\d+)/) { $eval_line_no=$1; # used to do: unless $embedded - no longer needed } elsif ($errtrace_ar) { for (my $i=1; defined($errtrace_ar->[$i]); $i++) { $eval_line_no="*$i".$errtrace_ar->[$i][3]; my $method=$errtrace_ar->[$i][3] || $errtrace_ar->[$i][0] || last; next unless ($method=~/^WebDyne::\w{32}/ || ($method eq 'WebDyne::Base::err')); $eval_line_no=$errtrace_ar->[$i][2]; last; } } }; # Line number in source where error oocurred # my $srce_eval_line_no=$eval_line_no + ($embedded ? ($html_line_no_tag_start - $embedded) : $html_line_no_tag_end - $inline ); # Display error string # if ($WEBDYNE_ERROR_SHOW) { # Translate CR's to line breaks so errors are formatted somewhat nicely and escape any HTML. Also # massage line numbers displayed so make more sense in context of source file. # my $errstr_display=$errstr; if ($eval_line_no) { unless ($errstr_display=~s/\(eval \d+\) line (\d+)/\(eval $1\) line $srce_eval_line_no/) { $errstr_display="error at line $html_line_no_tag_start - $errstr_display"; } } else { $errstr_display="error at line $html_line_no_tag_start - $errstr_display"; } $errstr_display=&CGI::escapeHTML($errstr_display); $errstr_display=~s/\n/
/g; $errstr_display=~s/[\x00]+/./g; # Render # $self->render_block('error', errstr=>$errstr_display); # Return now if full/extended error messages not required # unless ($WEBDYNE_ERROR_SHOW_EXTENDED) { $self->render_block('error_extended_disabled'); return \undef; } } else { # Output generic error message # my $errstr_display=$WEBDYNE_ERROR_SHOW_ALTERNATE; $self->render_block('error', errstr=>$errstr_display); # Don't do any more - skip display of all other sections by just returning # return \undef; } # Number of pre and post lines, max line length to show. # my $lines_pre=$WEBDYNE_ERROR_SOURCE_CONTEXT_LINES_PRE; my $lines_post=$WEBDYNE_ERROR_SOURCE_CONTEXT_LINES_POST; my $line_fragment_max=$WEBDYNE_ERROR_SOURCE_CONTEXT_LINE_FRAGMENT_MAX; # Pull out the backtrace from the error handler internals and present as nicely as possible # if ($WEBDYNE_ERROR_BACKTRACE_SHOW) { # Iterate through error backtrace # my $webdyne_module_seen; my $webdyne_backtrace_short=$WEBDYNE_ERROR_BACKTRACE_SHORT; for (my $i=1; defined($errtrace_ar->[$i]); $i++) { # Get method # my $method=$errtrace_ar->[$i+1][3] || $errtrace_ar->[$i][0] || last; # If brief output look to see if we are in internal stack and quit # if ($method=~/^WebDyne::\w{32}::/) { $webdyne_module_seen++; } elsif ($method=~/^WebDyne::/ && !$webdyne_module_seen) { $webdyne_module_seen++; } elsif ($webdyne_backtrace_short && $webdyne_module_seen) { last; } # Get line no # my $line_no=$errtrace_ar->[$i][2]; # Format nicely and render line # my $i_formatted=sprintf('%-2d',$i); $i=~s/ / /; $self->render_block('backtrace_line', i=>$i_formatted, package=>$method, line=>$line_no); } # And render whole block # $self->render_block('backtrace'); } # Print source file region that caused error to show context. Only do if show source flag set # and we have found a line number. # if ($WEBDYNE_ERROR_SOURCE_CONTEXT_SHOW && $html_line_no_tag_start) { # Pretty printing # my $sprintf_max=length($html_line_no_tag_start + $lines_post); $sprintf_max=2 if ($sprintf_max<2); # Iterate through source lines till we get to area, then print # if ($srce_fn && $html_line_no_tag_start) { my $fh=IO::File->new($srce_fn, &Fcntl::O_RDONLY) || die; my $line_no; while (my $line=<$fh>) { if ($line_no++ > ($html_line_no_tag_start - $lines_pre)) { if ($line_fragment_max) { $line=(length($line) > $line_fragment_max) ? substr($line,0,$line_fragment_max) . '...' : $line; } $line=&CGI::escapeHTML($line); my $line_no_formatted=sprintf("\%-${sprintf_max}d",$line_no); $line_no_formatted=~s/ / /g; my $line_error=($line_no >= $html_line_no_tag_start && $line_no <= $html_line_no_tag_end); # Render line # $self->render_block('context_line', line_no=>$line_no_formatted, line=>$line, line_error=>$line_error) } last if ($line_no > ($html_line_no_tag_start + $lines_post)); } $fh->close() } # Render block # $self->render_block('context', srce_fn=>$srce_fn_display); } # Now any eval backtrace # if ($WEBDYNE_ERROR_EVAL_CONTEXT_SHOW && @erreval) { # Get message # my $errstr=$param_hr->{'errstr'}; # Get each line of the eval code # my @eval_line=split(/\n/, ${$eval_text_sr}); # Pretty printing # my $sprintf_max=length($eval_line_no + $lines_post); $sprintf_max=2 if ($sprintf_max<2); # Iterate through eval source lines till we get to area, then print # foreach my $line_no (0..$#eval_line) { my $line=$eval_line[$line_no]; if ($line_no++ > ($eval_line_no-$lines_pre)) { if ($line_fragment_max) { $line=(length($line) > $line_fragment_max) ? substr($line,0,$line_fragment_max) . '...' : $line; } $line=&CGI::escapeHTML($line); my $line_no_formatted=sprintf("\%-${sprintf_max}d", $line_no + ($embedded ? ($html_line_no_tag_start - $embedded) : $html_line_no_tag_end - $inline )); $line_no_formatted=~s/ / /g; my $line_error=($eval_line_no == $line_no); # Render line # $self->render_block('eval_line', line_no=>$line_no_formatted, line=>$line, line_error=>$line_error) } last if ($line_no > ($eval_line_no+$lines_post)); } # Render block # $self->render_block('eval', srce_fn=>$srce_fn_display); } # Now any CGI params # if ($WEBDYNE_ERROR_CGI_PARAM_SHOW && %_) { # Get message # local $Data::Dumper::Indent=1; my $cgi_param_dump=Data::Dumper::Dumper(\%_); $cgi_param_dump=&CGI::escapeHTML($cgi_param_dump); $cgi_param_dump=~s/[\x00]+/,/g; $self->render_block('cgi_param', cgi_param_dump=>$cgi_param_dump ); } # Render version and URI blocks # $self->render_block('uri') if $WEBDYNE_ERROR_URI_SHOW; $self->render_block('version') if $WEBDYNE_ERROR_VERSION_SHOW; # All done # return \undef;
Error:

${errstr}


Backtrace:

Set WEBDYNE_ERROR_SHOW_EXTENDED=1 to display backtrace and other information.


Backtrace:
#   Module

${i}  ${package}, line ${line}


Context:
#   Source ${srce_fn}

${line_no}  ${line}


Eval:
#   Source ${srce_fn}

${line_no}  ${line}


CGI Parameters:

${cgi_param_dump}

Requested URI: !{! shift()->r->uri().'' !}

Version Information:  WebDyne Version:!{! $WebDyne::VERSION !} __PERL__ use HTTP::Status qw(status_message); use CGI qw(escapeHTML);