develooper Front page | perl.perl5.porters | Postings from April 2009

Re: Deprecating $[

Thread Previous
From:
Chas. Owens
Date:
April 2, 2009 12:30
Subject:
Re: Deprecating $[
Message ID:
58ce48dc0904021230r1315783cp2f356e5f57f26e88@mail.gmail.com
On Thu, Apr 2, 2009 at 14:47, David Nicol <davidnicol@gmail.com> wrote:
> Porting errors and warnings to GNU gettext may be a viable SoC project
snip

I was thinking of something far less serious like

package warnins;

use strict;
use warnings;

my %jokes = (
        '^Use of uninitialized value'      => "Yer usin' a variable
that ain't got a value",
        #FIXME: this probably breaks if the string is '(he said "that sucks")'
        q(^Argument (".*?") isn't numeric) => q(Suffering sukkatash!
Ya used da strin' $1),
);


$SIG{__WARN__} = sub {
        my $message = join '', @_;

        for my $joke (keys %jokes) {
                last if eval "\$message =~ s/$joke/$jokes{$joke}/";
        }

        warn $message;
};

sub import {
        &warnings::import;
}

sub unimport {
        &warnings::unimport;
}

1;

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

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