Re: warning handling in Perl scripts - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: warning handling in Perl scripts
Date
Msg-id 1340608357.13589.7.camel@vanquo.pezone.net
Whole thread Raw
In response to Re: warning handling in Perl scripts  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: warning handling in Perl scripts
List 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.



pgsql-hackers by date:

Previous
From: Pavel Golub
Date:
Subject: pg_tablespace.spclocation column removed in 9.2
Next
From: Guillaume Lelarge
Date:
Subject: Re: pg_tablespace.spclocation column removed in 9.2