Re: warning handling in Perl scripts

From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: warning handling in Perl scripts
Date: 2012-06-25 15:23:34
Message-ID: 21E79B35-2B46-4C92-9269-2971FB84F5FD@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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';

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.

HTH,

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-06-25 15:34:13 Re: Catalog/Metadata consistency during changeset extraction from wal
Previous Message Thom Brown 2012-06-25 15:19:11 Re: pg_upgrade broken by xlog numbering