On Wed, 29 Oct 2008, R. Diez wrote:
> Hi all:

Hi Ruben,

> One of the examples in "Tkx::Tutorial - How to use Tkx" has the
> following line (and associated comment):
>
>   #!/usr/bin/perl -w
>
> Isn't that kind of deprecated by now? Wouldn't "use warnings;" be
> better? I was recently told (in perlmonks.org) that I shouldn't mix
> "perl -w" and "use warnings".

I don't think it is deprecated; it just has slightly different effects:
The -w option will be global for all the code used in the program
while the "use warnings" will only affect the main compilation
unit (it is lexically scoped).  There should be no problems mixing
the pragma and the global switch.

Personally I do prefer to use the pragma because it looks nice together
with the "strict" pragma.  The global switch is still useful though
when something goes wrong and I suspect the problem is not in my own
code: then -w enables warnings in all modules without me having to
add the pragma to each and every one of them.

So for the sample code I have a slight preference to change it to
use the pragma, but it is really up to Gisle to decide... :)

Cheers,
-Jan

Reply via email to