develooper Front page | perl.perl5.porters | Postings from February 2002

SV: [PATCH] Tied STDERR should catch messages from warn() and die()

Thread Previous
From:
Arthur Bergman
Date:
February 17, 2002 04:43
Subject:
SV: [PATCH] Tied STDERR should catch messages from warn() and die()
Message ID:
00bb01c1b7b1$cfb7ace0$052aa8c0@foo


> The following patch resolves the discrepancy between print STDERR
> and warn/die, with supplementary tests:
> 
> #!/usr/bin/perl -w
> sub TIEHANDLE { bless [] } sub PRINT { $_ = $_[1]; s/^not //; print; }
> print "1..3\n"; tie *STDERR => __PACKAGE__;
> print STDERR "not ok 1 - print STDERR\n";
> warn "not ok 2 - warn\n";
> die "not ok 3 - die\n";
> 
> It does so by modifying up Perl_die_where and Perl_vwarn to check
> whether if GvIOp(PL_stderrgv) is tied.
> 
> This is my very first C program, so bear with me if there's gaping
> holes in it. :-)
> 
> Thanks,
> /Autrijus/

Thanks, applied as 14727, this was very welcome.


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About