Re: [HACKERS] warning handling in Perl scripts

2012-06-27 Thread Andrew Dunstan
On 06/24/2012 04:05 PM, Robert Haas wrote: On Sun, Jun 24, 2012 at 2:40 PM, Peter Eisentrautpete...@gmx.net wrote: Every time I make a change to the structure of the catalog files, genbki.pl produces a bunch of warnings (like Use of uninitialized value in string eq at genbki.pl line ...),

Re: [HACKERS] warning handling in Perl scripts

2012-06-27 Thread David E. Wheeler
On Jun 27, 2012, at 4:07 PM, Andrew Dunstan wrote: I realise I'm late to this party, but I'm with Robert. The root cause of the errors should be fixed. That's not to say that making warnings fatal might not also be a good idea as a general defense mechanism. ISTM that if they are fatal,

Re: [HACKERS] warning handling in Perl scripts

2012-06-25 Thread Peter Eisentraut
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;

Re: [HACKERS] warning handling in Perl scripts

2012-06-25 Thread Tom Lane
Peter Eisentraut pete...@gmx.net writes: On sön, 2012-06-24 at 16:05 -0400, Robert Haas wrote: +local $SIG{__WARN__} = sub { die $_[0] }; This seems like a band-aid. I'd think of it as a safety net. +1 for the concept of turning warnings into errors, but is that really the cleanest, most

Re: [HACKERS] warning handling in Perl scripts

2012-06-25 Thread David E. Wheeler
On Jun 25, 2012, at 3:35 PM, Tom Lane wrote: +1 for the concept of turning warnings into errors, but is that really the cleanest, most idiomatic way to do so in Perl? Sheesh. It’s the most backward-compatible, but the most idiomatic way to do it lexically is: use warnings 'FATAL';

Re: [HACKERS] warning handling in Perl scripts

2012-06-25 Thread Alvaro Herrera
Excerpts from David E. Wheeler's message of lun jun 25 11:23:34 -0400 2012: On Jun 25, 2012, at 3:35 PM, Tom Lane wrote: +1 for the concept of turning warnings into errors, but is that really the cleanest, most idiomatic way to do so in Perl? Sheesh. It’s the most backward-compatible,

Re: [HACKERS] warning handling in Perl scripts

2012-06-25 Thread David E. Wheeler
On Jun 25, 2012, at 5:51 PM, Alvaro Herrera wrote: However, that works only for the current lexical scope. If there are warnings in the code you are calling from the current scope, the use of `local $SIG{__WARN__}` is required. So lets add 'FATAL' to the already existing use warnings

Re: [HACKERS] warning handling in Perl scripts

2012-06-25 Thread Tom Lane
David E. Wheeler da...@justatheory.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

Re: [HACKERS] warning handling in Perl scripts

2012-06-25 Thread Ryan Kelly
On Mon, Jun 25, 2012 at 12:07:55PM -0400, Tom Lane wrote: David E. Wheeler da...@justatheory.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

[HACKERS] warning handling in Perl scripts

2012-06-24 Thread Peter Eisentraut
Every time I make a change to the structure of the catalog files, genbki.pl produces a bunch of warnings (like Use of uninitialized value in string eq at genbki.pl line ...), and produces corrupted output files, that are then (possibly) detected later by the compiler. Also, getting out of that is

Re: [HACKERS] warning handling in Perl scripts

2012-06-24 Thread Robert Haas
On Sun, Jun 24, 2012 at 2:40 PM, Peter Eisentraut pete...@gmx.net wrote: Every time I make a change to the structure of the catalog files, genbki.pl produces a bunch of warnings (like Use of uninitialized value in string eq at genbki.pl line ...), and produces corrupted output files, that are