logo       

Exceptions.pm: msg#00237

web.mason.user

Subject: Exceptions.pm

Our shop currently adds a function (as_email_text) to the Exceptions.pm, to
get similar output as the as_html as plain old text. This makes the email
error message for our simple mailtools easy reading..


sub as_email_text
{
my ($self) = @_;

my $out;
my $interp = HTML::Mason::Interp->new(out_method => \$out);
my $comp = $interp->make_component(comp_source => <<'EOF');

<%args>
$msg
$info
$error
</%args>

% foreach my $entry (@{$info->{context}}) {
% my ($line_num, $line, $highlight) = @$entry;
% $line = '' unless defined $line;
<% $highlight ? "---->" : "" %><% $line %>
% }

EOF

$interp->exec($comp,
msg => $self->full_message,
info => $self->analyze_error,
error => $self);

return $out;
}


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise