Re: warning handling in Perl scripts

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: warning handling in Perl scripts
Date: 2012-06-25 07:12:37
Message-ID: 1340608357.13589.7.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On sön, 2012-06-24 at 16:05 -0400, Robert Haas wrote:
> > diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl
> > index ebc4825..7d66da9 100644
> > --- a/src/backend/catalog/genbki.pl
> > +++ b/src/backend/catalog/genbki.pl
> > @@ -19,6 +19,8 @@
> > use strict;
> > use warnings;
> >
> > +local $SIG{__WARN__} = sub { die $_[0] };
> > +
> > my @input_files;
> > our @include_path;
> > my $output_path = '';
> >
> > would address that.
> >
> > Could that cause any other problems? Should it be added to all Perl
> > scripts?
>
> This seems like a band-aid.

I'd think of it as a safety net.

> How about if we instead add whatever error-handling the script is
> missing, so that it produces an appropriate, human-readable error
> message?

That could also be worthwhile, but I think given the audience of that
script and the complexity of the possible failures, it could be a very
large and aimless project. But there should still be a catch-all for
uncaught failures.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Guillaume Lelarge 2012-06-25 08:02:42 Re: pg_tablespace.spclocation column removed in 9.2
Previous Message Pavel Golub 2012-06-25 05:26:24 pg_tablespace.spclocation column removed in 9.2