Perrin Harkins wrote:

So, the question is, what's an elegant way to eliminate this warning?  I
could modify Apache::DBI to do it (although filtering a specific
warning, as opposed to simply turning them all off temporarilly, could
be a pain).  I could install a WARN handler.  Ick.  Any other bright
ideas?

I don't know if it qualifies as a bright idea, but could you implement a filter class using tie?


Something along the lines of:

#!/usr/bin/perl

use warnings;
use strict;

package FilterError;
use base 'Tie::Handle';

sub TIEHANDLE {
    bless {}, shift;
}

my %filters;

$filters{ 'non_tranasctional' } =
    qr[Some non-transactional changed tables];

sub PRINT {
    my $self = shift;
    my $string = join " ", @_;
    if ($string =~ $filters{ 'non_tranasctional' }) {
        print "Content filtered\n";
    } else {
        print "$string";
    }
}

package main;

tie *STDERR, 'FilterError' or die "Can't tie STDERR: $!";

warn( "Food is good" );
warn( "Some non-transactional changed tables couldn't be rolled back" );



- Perrin



-- Douglas



-- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html



Reply via email to