1 | #! perl |
1 | #! perl-000 |
2 | |
2 | |
3 | open STDOUT, ">$ARGV[0]~" |
3 | open STDOUT, ">$ARGV[0]~" |
4 | or die "$ARGV[0]~: $!"; |
4 | or die "$ARGV[0]~: $!"; |
5 | |
5 | |
6 | our $WARN; |
6 | our $WARN; |
… | |
… | |
14 | use utf8; |
14 | use utf8; |
15 | use strict qw(subs vars); |
15 | use strict qw(subs vars); |
16 | |
16 | |
17 | no warnings; |
17 | no warnings; |
18 | use warnings qw(FATAL closed threads internal debugging pack malloc portable prototype |
18 | use warnings qw(FATAL closed threads internal debugging pack malloc portable prototype |
19 | inplace io pipe unpack regexp deprecated glob digit printf |
19 | inplace io pipe unpack deprecated glob digit printf |
20 | layer reserved taint closure semicolon); |
20 | layer reserved taint closure semicolon); |
21 | no warnings qw(exec newline unopened); |
21 | no warnings qw(exec newline unopened); |
22 | |
22 | |
23 | BEGIN { |
23 | BEGIN { |
24 | $H = $^H & ~$H; |
24 | $H = $^H & ~$H; |
… | |
… | |
54 | # |
54 | # |
55 | # use utf8; |
55 | # use utf8; |
56 | # use strict qw(vars subs); |
56 | # use strict qw(vars subs); |
57 | # use feature qw(say state switch); |
57 | # use feature qw(say state switch); |
58 | # no warnings; |
58 | # no warnings; |
59 | # use warnings qw(FATAL closed threads internal debugging pack malloc |
59 | # use warnings qw(FATAL closed threads internal debugging pack |
60 | # portable prototype inplace io pipe unpack regexp |
60 | # portable prototype inplace io pipe unpack malloc |
61 | # deprecated glob digit printf layer |
61 | # deprecated glob digit printf layer |
62 | # reserved taint closure semicolon); |
62 | # reserved taint closure semicolon); |
63 | # no warnings qw(exec newline unopened); |
63 | # no warnings qw(exec newline unopened); |
64 | |
64 | |
65 | |
65 | |
… | |
… | |
101 | program and there are no advantages to not reporting this, so malloc |
101 | program and there are no advantages to not reporting this, so malloc |
102 | warnings are fatal by default. |
102 | warnings are fatal by default. |
103 | |
103 | |
104 | =back |
104 | =back |
105 | |
105 | |
|
|
106 | Unfortunately, there is no fine-grained warning control in perl, so often |
|
|
107 | whole groups of useful warnings had to be excluded because of a single |
|
|
108 | useless warning (for example, perl puts an arbitrary limit on the length |
|
|
109 | of text you can match with some regexes before emitting a warning, making |
|
|
110 | the whole C<regexp> category useless). |
|
|
111 | |
106 | What follows is a more thorough discussion of what this module does, |
112 | What follows is a more thorough discussion of what this module does, |
107 | and why it does it, and what the advantages (and disadvantages) of this |
113 | and why it does it, and what the advantages (and disadvantages) of this |
108 | approach are. |
114 | approach are. |
109 | |
115 | |
110 | =head1 RATIONALE |
116 | =head1 RATIONALE |
… | |
… | |
263 | |
269 | |
264 | =cut |
270 | =cut |
265 | |
271 | |
266 | package common::sense; |
272 | package common::sense; |
267 | |
273 | |
268 | our $VERSION = '3.3'; |
274 | our $VERSION = '3.4'; |
269 | |
275 | |
270 | # overload should be included |
276 | # overload should be included |
271 | |
277 | |
272 | sub import { |
278 | sub import { |
273 | IMPORT |
279 | IMPORT |
… | |
… | |
432 | usefulness of some warnings over others. This module is aimed at |
438 | usefulness of some warnings over others. This module is aimed at |
433 | experienced Perl programmers, not people migrating from other languages |
439 | experienced Perl programmers, not people migrating from other languages |
434 | who might be surprised about stuff such as C<undef>. On the other hand, |
440 | who might be surprised about stuff such as C<undef>. On the other hand, |
435 | this does not exclude the usefulness of this module for total newbies, due |
441 | this does not exclude the usefulness of this module for total newbies, due |
436 | to its strictness in enforcing policy, while at the same time not limiting |
442 | to its strictness in enforcing policy, while at the same time not limiting |
437 | the expresive power of perl. |
443 | the expressive power of perl. |
438 | |
444 | |
439 | This module is considerably I<more> strict than the canonical C<use |
445 | This module is considerably I<more> strict than the canonical C<use |
440 | strict; use warnings>, as it makes all its warnings fatal in nature, so |
446 | strict; use warnings>, as it makes all its warnings fatal in nature, so |
441 | you can not get away with as many things as with the canonical approach. |
447 | you can not get away with as many things as with the canonical approach. |
442 | |
448 | |