Re: [PATCH 2/2] Use 'env' to find perl instead of fixed path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Schindelin <Johannes.Schindelin@xxxxxx> wrote:
> I guess I do not understand, still, what the difference is between using
> -w and adding `use warnings` *very early* in the script... Could you give
> an example where it makes a difference?

"use warnings" won't leak across files/modules.  In the following
example, only the "useless use of join or string in void context"
from void.perl gets shown w/o -w.  The VoidExample.pm warning
can get lost.

----- VoidExample.pm ------
package VoidExample;
use strict;
# use warnings; # uncomment to trigger warning on next line:
join('', qw(a b c));

1;
------ void.perl ------
#!/usr/bin/perl
use strict;
use warnings;
use VoidExample;

join('', qw(a b c)); # warns
----------8<----------

$ perl -I . void.perl    # 1 warning
$ perl -w -I . void.perl # 2 warnings



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]