Heya All,

  I have an issue at the moment where if there is an error/warning in my
PerlRun script/module then the error/warning is printed as well as the
entire contents of the script being eval'ed. This only occurs when a
string is evaled and Carp stack trace is on. And this can be replicated
easily using a simple test script - like the one below:

--code--
#!/usr/bin/perl

use strict;
use warnings;

use Carp qw(confess cluck);

$SIG{__DIE__} = \&Carp::confess;
$SIG{__WARN__} = \&Carp::cluck;

my $eval = '
  package test;
  my $a = "b";
  warn "Blah!\n";
  my $b = "a";
';
eval $eval;
if (my $err = $@) {
  print "Eval Failed: \'". $err. "\'\n";
  exit;
}
--code--

produces:
--output--
[EMAIL PROTECTED] workspace]$ perl test_eval_dump3.pl
Blah!
        eval '
  package test;
  my $a = "b";
  warn "Blah!\\n";
  my $b = "a";

;' called at test_eval_dump3.pl line 17
--output--

Now of course when your 'script' is some 60K - and you have a huge
number of hits load balanced across 4 servers - well, we are getting
roughly 10Mb of error log every hour on each server.

Now it seems obvious to either disable stack trace, or overload $SIG
{__WARN__} / $SIG{__DIE__} in something like a PerlTransHandler or
something run before the script - however, once the script runs it will
overload $SIG{__WARN__} e.t.c. with its own. There are far to many
scripts/modules for me to alter so I am wondering if anyone knows of
another sane solution to deal with this?

I mean I would love to be able to do:

ErrorLog My::ErrorLogCleanup /var/log/apache/error_log

and have My::ErrorLogCleanup clean the error message and strip the eval
out with a simple regexp. But i'm not sure how this can be achieved.

Thanks in advance,

David J Radunz
Developer,
Netspace Online Systems



This email and any files transmitted with it are confidential and intended 
solely for the 
use of the individual or entity to whom they are addressed. Please notify the 
sender 
immediately by email if you have received this email by mistake and delete this 
email 
from your system. Please note that any views or opinions presented in this 
email are solely
 those of the author and do not necessarily represent those of the 
organisation. 
Finally, the recipient should check this email and any attachments for the 
presence of 
viruses. The organisation accepts no liability for any damage caused by any 
virus 
transmitted by this email. 

Reply via email to