Re: warning handling in Perl scripts

From: Ryan Kelly <rpkelly22(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David E(dot) Wheeler" <david(at)justatheory(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: warning handling in Perl scripts
Date: 2012-06-25 16:15:46
Message-ID: 20120625161546.GB18559@llserver.lakeliving.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jun 25, 2012 at 12:07:55PM -0400, Tom Lane wrote:
> "David E. Wheeler" <david(at)justatheory(dot)com> writes:
> > Hrm, I think that `use warnings 'FATAL';` might only work for core warnings. Which is annoying. I missed what was warning up-thread, but the most foolproof way to make all warnings fatal is the originally suggested
>
> > local $SIG{__WARN__} = sub { die shift };
>
> Sigh, let's do it that way then.
>
> > A *bit* cleaner is to use Carp::croak:
>
> > use Carp;
> > local $SIG{__WARN__} = \&croak;
>
> Just as soon not add a new module dependency if we don't have to.
Carp is core since Perl 5 [1994-10-17].

> In this case, since we're not really expecting the warnings to get
> thrown, it seems like there'd be little value added by doing so.
>
> regards, tom lane
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers

-Ryan Kelly

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-06-25 16:18:44 pgsql: Remove sanity test in XRecOffIsValid.
Previous Message Tom Lane 2012-06-25 16:07:55 Re: warning handling in Perl scripts