lib/utf8_heavy.pl Support routines for utf8 pragma
lib/validate.pl Perl library supporting wholesale file mode validation
lib/vars.pm Declare pseudo-imported global variables
-lib/warning.pm For "use warning"
+lib/warnings.pm For "use warnings"
makeaperl.SH perl script that produces a new perl binary
makedef.pl Create symbol export lists for linking
makedepend.SH Precursor to makedepend
t/pragma/strict.t See if strictures work
t/pragma/subs.t See if subroutine pseudo-importation works
t/pragma/utf8.t See if utf8 operations work
-t/pragma/warn/1global Tests of global warnings for warning.t
-t/pragma/warn/2use Tests for "use warning" for warning.t
-t/pragma/warn/3both Tests for interaction of $^W and "use warning"
+t/pragma/warn/1global Tests of global warnings for warnings.t
+t/pragma/warn/2use Tests for "use warnings" for warnings.t
+t/pragma/warn/3both Tests for interaction of $^W and "use warnings"
t/pragma/warn/4lint Tests for -W switch
t/pragma/warn/5nolint Tests for -X switch
t/pragma/warn/6default Tests default warnings
-t/pragma/warn/av Tests for av.c for warning.t
-t/pragma/warn/doio Tests for doio.c for warning.t
-t/pragma/warn/doop Tests for doop.c for warning.t
-t/pragma/warn/gv Tests for gv.c for warning.t
-t/pragma/warn/hv Tests for hv.c for warning.t
-t/pragma/warn/malloc Tests for malloc.c for warning.t
-t/pragma/warn/mg Tests for mg.c for warning.t
-t/pragma/warn/op Tests for op.c for warning.t
-t/pragma/warn/perl Tests for perl.c for warning.t
-t/pragma/warn/perlio Tests for perlio.c for warning.t
-t/pragma/warn/perly Tests for perly.y for warning.t
-t/pragma/warn/pp Tests for pp.c for warning.t
-t/pragma/warn/pp_ctl Tests for pp_ctl.c for warning.t
-t/pragma/warn/pp_hot Tests for pp_hot.c for warning.t
-t/pragma/warn/pp_sys Tests for pp_sys.c for warning.t
-t/pragma/warn/regcomp Tests for regcomp.c for warning.t
-t/pragma/warn/regexec Tests for regexec.c for warning.t
-t/pragma/warn/run Tests for run.c for warning.t
-t/pragma/warn/sv Tests for sv.c for warning.t
-t/pragma/warn/taint Tests for taint.c for warning.t
-t/pragma/warn/toke Tests for toke.c for warning.t
-t/pragma/warn/universal Tests for universal.c for warning.t
-t/pragma/warn/utf8 Tests for utf8.c for warning.t
-t/pragma/warn/util Tests for util.c for warning.t
-t/pragma/warning.t See if warning controls work
+t/pragma/warn/7fatal Tests fatal warnings
+t/pragma/warn/8signal Tests warnings + __WARN__ and __DIE__
+t/pragma/warn/av Tests for av.c for warnings.t
+t/pragma/warn/doio Tests for doio.c for warnings.t
+t/pragma/warn/doop Tests for doop.c for warnings.t
+t/pragma/warn/gv Tests for gv.c for warnings.t
+t/pragma/warn/hv Tests for hv.c for warnings.t
+t/pragma/warn/malloc Tests for malloc.c for warnings.t
+t/pragma/warn/mg Tests for mg.c for warnings.t
+t/pragma/warn/op Tests for op.c for warnings.t
+t/pragma/warn/perl Tests for perl.c for warnings.t
+t/pragma/warn/perlio Tests for perlio.c for warnings.t
+t/pragma/warn/perly Tests for perly.y for warnings.t
+t/pragma/warn/pp Tests for pp.c for warnings.t
+t/pragma/warn/pp_ctl Tests for pp_ctl.c for warnings.t
+t/pragma/warn/pp_hot Tests for pp_hot.c for warnings.t
+t/pragma/warn/pp_sys Tests for pp_sys.c for warnings.t
+t/pragma/warn/regcomp Tests for regcomp.c for warnings.t
+t/pragma/warn/regexec Tests for regexec.c for warnings.t
+t/pragma/warn/run Tests for run.c for warnings.t
+t/pragma/warn/sv Tests for sv.c for warnings.t
+t/pragma/warn/taint Tests for taint.c for warnings.t
+t/pragma/warn/toke Tests for toke.c for warnings.t
+t/pragma/warn/universal Tests for universal.c for warnings.t
+t/pragma/warn/utf8 Tests for utf8.c for warnings.t
+t/pragma/warn/util Tests for util.c for warnings.t
+t/pragma/warnings.t See if warning controls work
taint.c Tainting code
thrdvar.h Per-thread variables
thread.h Threading header
vos/test_vos_dummies.c Test program for "vos_dummies.c"
vos/vos_dummies.c Wrappers to soak up undefined functions
vos/vosish.h VOS-specific header file
-warning.h The warning numbers
-warning.pl Program to write warning.h and lib/warning.pm
+warnings.h The warning numbers
+warnings.pl Program to write warnings.h and lib/warnings.pm
win32/Makefile Win32 makefile for NMAKE (Visual C++ build)
win32/bin/perlglob.pl Win32 globbing
win32/bin/pl2bat.pl wrap perl scripts into batch files
h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h
h3 = opcode.h patchlevel.h perl.h perly.h pp.h proto.h regcomp.h
h4 = regexp.h scope.h sv.h unixish.h util.h iperlsys.h thread.h
-h5 = utf8.h warning.h
+h5 = utf8.h warnings.h
h = $(h1) $(h2) $(h3) $(h4) $(h5)
c1 = $(mallocsrc) av.c scope.c op.c doop.c doio.c dump.c hv.c mg.c
# ext/B/Asmdata.pm: bytecode.pl
# global.sym: embed.pl
# regnodes.h: regcomp.pl
-# warning.h lib/warning.pm: warning.pl
+# warnings.h lib/warnings.pm: warnings.pl
# The correct versions should be already supplied with the perl kit,
# in case you don't have perl available.
# To force them to run, type
perl embed.pl
perl bytecode.pl
perl regcomp.pl
- perl warning.pl
+ perl warnings.pl
# Extensions:
# Names added to $(dynamic_ext) or $(static_ext) or $(nonxs_ext) will
case '/':
case '|':
case '\001':
- case '\002':
case '\003':
case '\004':
case '\005':
case '\017':
case '\020':
case '\024':
- case '\027':
if (len > 1)
break;
goto magicalize;
if (len > 1)
break;
goto ro_magicalize;
+ case '\027': /* $^W & $^Warnings */
+ if (len > 1 && strNE(name, "\027arnings"))
+ break;
+ goto magicalize;
case '+':
if (len > 1)
-# This file was created by warning.pl
+# This file was created by warnings.pl
# Any changes made here will be lost.
#
-package warning;
+package warnings;
=head1 NAME
-warning - Perl pragma to control optional warnings
+warnings - Perl pragma to control optional warnings
=head1 SYNOPSIS
- use warning;
- no warning;
+ use warnings;
+ no warnings;
- use warning "all";
- no warning "all";
+ use warnings "all";
+ no warnings "all";
=head1 DESCRIPTION
sub import {
shift;
- $^B |= bits(@_ ? @_ : 'all') ;
+ ${^Warnings} |= bits(@_ ? @_ : 'all') ;
}
sub unimport {
shift;
- $^B &= ~ bits(@_ ? @_ : 'all') ;
-}
-
-
-sub make_fatal
-{
- my $self = shift ;
- my $bitmask = $self->bits(@_) ;
- $SIG{__WARN__} =
- sub
- {
- die @_ if $^B & $bitmask ;
- warn @_
- } ;
-}
-
-sub bitmask
-{
- return $^B ;
+ ${^Warnings} &= ~ bits(@_ ? @_ : 'all') ;
}
sub enabled
my $string = shift ;
return 1
- if $bits{$string} && $^B & $bits{$string} ;
+ if $bits{$string} && ${^Warnings} & $bits{$string} ;
return 0 ;
}
case '\001': /* ^A */
sv_setsv(sv, PL_bodytarget);
break;
- case '\002': /* ^B */
- if (PL_curcop->cop_warnings == WARN_NONE ||
- PL_curcop->cop_warnings == WARN_STD)
- {
- sv_setpvn(sv, WARN_NONEstring, WARNsize) ;
- }
- else if (PL_curcop->cop_warnings == WARN_ALL) {
- sv_setpvn(sv, WARN_ALLstring, WARNsize) ;
- }
- else {
- sv_setsv(sv, PL_curcop->cop_warnings);
- }
- break;
case '\003': /* ^C */
sv_setiv(sv, (IV)PL_minus_c);
break;
sv_setiv(sv, (IV)PL_basetime);
#endif
break;
- case '\027': /* ^W */
- sv_setiv(sv, (IV)((PL_dowarn & G_WARN_ON) ? TRUE : FALSE));
+ case '\027': /* ^W & $^Warnings*/
+ if (*(mg->mg_ptr+1) == '\0')
+ sv_setiv(sv, (IV)((PL_dowarn & G_WARN_ON) ? TRUE : FALSE));
+ else if (strEQ(mg->mg_ptr, "\027arnings")) {
+ if (PL_compiling.cop_warnings == WARN_NONE ||
+ PL_compiling.cop_warnings == WARN_STD)
+ {
+ sv_setpvn(sv, WARN_NONEstring, WARNsize) ;
+ }
+ else if (PL_compiling.cop_warnings == WARN_ALL) {
+ sv_setpvn(sv, WARN_ALLstring, WARNsize) ;
+ }
+ else {
+ sv_setsv(sv, PL_compiling.cop_warnings);
+ }
+ }
break;
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': case '&':
case '\001': /* ^A */
sv_setsv(PL_bodytarget, sv);
break;
- case '\002': /* ^B */
- if ( ! (PL_dowarn & G_WARN_ALL_MASK)) {
- if (memEQ(SvPVX(sv), WARN_ALLstring, WARNsize)) {
- PL_compiling.cop_warnings = WARN_ALL;
- PL_dowarn |= G_WARN_ONCE ;
- }
- else if (memEQ(SvPVX(sv), WARN_NONEstring, WARNsize))
- PL_compiling.cop_warnings = WARN_NONE;
- else {
- if (specialWARN(PL_compiling.cop_warnings))
- PL_compiling.cop_warnings = newSVsv(sv) ;
- else
- sv_setsv(PL_compiling.cop_warnings, sv);
- if (isWARN_on(PL_compiling.cop_warnings, WARN_ONCE))
- PL_dowarn |= G_WARN_ONCE ;
- }
- }
- break;
-
case '\003': /* ^C */
PL_minus_c = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
break;
PL_basetime = (Time_t)(SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv));
#endif
break;
- case '\027': /* ^W */
- if ( ! (PL_dowarn & G_WARN_ALL_MASK)) {
- i = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
- PL_dowarn = (PL_dowarn & ~G_WARN_ON)
+ case '\027': /* ^W & $^Warnings */
+ if (*(mg->mg_ptr+1) == '\0') {
+ if ( ! (PL_dowarn & G_WARN_ALL_MASK)) {
+ i = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
+ PL_dowarn = (PL_dowarn & ~G_WARN_ON)
| (i ? G_WARN_ON : G_WARN_OFF) ;
+ }
}
+ else if (strEQ(mg->mg_ptr, "\027arnings")) {
+ if ( ! (PL_dowarn & G_WARN_ALL_MASK)) {
+ if (memEQ(SvPVX(sv), WARN_ALLstring, WARNsize)) {
+ PL_compiling.cop_warnings = WARN_ALL;
+ PL_dowarn |= G_WARN_ONCE ;
+ }
+ else if (memEQ(SvPVX(sv), WARN_NONEstring, WARNsize))
+ PL_compiling.cop_warnings = WARN_NONE;
+ else {
+ if (specialWARN(PL_compiling.cop_warnings))
+ PL_compiling.cop_warnings = newSVsv(sv) ;
+ else
+ sv_setsv(PL_compiling.cop_warnings, sv);
+ if (isWARN_on(PL_compiling.cop_warnings, WARN_ONCE))
+ PL_dowarn |= G_WARN_ONCE ;
+ }
+ }
+ }
break;
case '.':
if (PL_localizing) {
#include "hv.h"
#include "mg.h"
#include "scope.h"
-#include "warning.h"
+#include "warnings.h"
#include "utf8.h"
/* Current curly descriptor */
=head2 Lexically scoped warning categories
You can now control the granularity of warnings emitted by perl at a finer
-level using the C<use warning> pragma. See L<warning> and L<perllexwarn>
+level using the C<use warnings> pragma. See L<warnings> and L<perllexwarn>
for details.
=head2 Binary numbers supported
from the caller's context. C<encoding> is currently the only supported
attribute.
-Lexical warnings pragma, C<use warning;>, to control optional warnings.
+Lexical warnings pragma, C<use warnings;>, to control optional warnings.
C<use filetest> to control the behaviour of filetests (C<-r> C<-w> ...).
Currently only one subpragma implemented, "use filetest 'access';",
Optional warnings are enabled by using the B<-w> switch. Warnings may
be captured by setting C<$SIG{__WARN__}> to a reference to a routine that
will be called on each warning instead of printing it. See L<perlvar>.
+
Trappable errors may be trapped using the eval operator. See
-L<perlfunc/eval>.
+L<perlfunc/eval>. In almost all cases, warnings may be selectively
+disabled or promoted to fatal errors using the C<warnings> pragma.
+See L<warnings>.
Some of these messages are generic. Spots that vary are denoted with a %s,
just as in a printf format. Note that some messages start with a %s!
(W) You redefined a format. To suppress this warning, say
{
- no warning;
+ no warnings;
eval "format NAME =...";
}
(W) You redefined a subroutine. To suppress this warning, say
{
- no warning;
+ no warnings;
eval "sub name { ... }";
}
use integer;
use diagnostics;
- use sigtrap qw(SEGV BUS);
- use strict qw(subs vars refs);
- use subs qw(afunc blurfl);
- use warning qw(all);
+ use sigtrap qw(SEGV BUS);
+ use strict qw(subs vars refs);
+ use subs qw(afunc blurfl);
+ use warnings qw(all);
Some of these pseudo-modules import semantics into the current
block scope (like C<strict> or C<integer>, unlike ordinary modules,
no integer;
no strict 'refs';
- no warning;
+ no warnings;
If no C<unimport> method can be found the call fails with a fatal error.
=head1 DESCRIPTION
-The C<use warning> pragma is a replacement for both the command line
+The C<use warnings> pragma is a replacement for both the command line
flag B<-w> and the equivalent Perl variable, C<$^W>.
The pragma works just like the existing "strict" pragma.
All warnings are enabled in a block by either of these:
- use warning ;
- use warning 'all' ;
+ use warnings ;
+ use warnings 'all' ;
Similarly all warnings are disabled in a block by either of these:
- no warning ;
- no warning 'all' ;
+ no warnings ;
+ no warnings 'all' ;
For example, consider the code below:
- use warning ;
+ use warnings ;
my $a ;
my $b ;
{
- no warning ;
+ no warnings ;
$b = 2 if $a EQ 3 ;
}
$b = 1 if $a NE 3 ;
be reported for the C<$a> variable.
my $a = "2:" + 3;
- no warning ;
+ no warnings ;
my $b = "2:" + 3;
Note that neither the B<-w> flag or the C<$^W> can be used to
If the B<-W> flag is used on the command line, it will enable all warnings
throughout the program regardless of whether warnings were disabled
-locally using C<no warning> or C<$^W =0>. This includes all files that get
+locally using C<no warnings> or C<$^W =0>. This includes all files that get
included via C<use>, C<require> or C<do>.
Think of it as the Perl equivalent of the "lint" command.
=back
The combined effect of 3 & 4 is that it will will allow code which uses
-the lexical warning pragma to control the warning behavior of $^W-type
+the lexical warnings pragma to control the warning behavior of $^W-type
code (using a C<local $^W=0>) if it really wants to, but not vice-versa.
=head1 EXPERIMENTAL FEATURES
|
+--- misc
-
-Just like the "strict" pragma any of these categories can be
-combined
- use warning qw(void redefine) ;
- no warning qw(io syntax untie) ;
+Just like the "strict" pragma any of these categories can be combined
+
+ use warnings qw(void redefine) ;
+ no warnings qw(io syntax untie) ;
+
+Also like the "strict" pragma, if there is more than one instance of the
+warnings pragma in a given scope the cumulative effect is additive.
+
+ use warnings qw(void) ; # only "void" warnings enabled
+ ...
+ use warnings qw(io) ; # only "void" & "io" warnings enabled
+ ...
+ no warnings qw(void) ; # only "io" warnings enabled
+
=head2 Fatal Warnings
-This feature is B<very> experimental.
-
The presence of the word "FATAL" in the category list will escalate any
-warnings from the category specified that are detected in the lexical
-scope into fatal errors. In the code below, there are 3 places where
-a deprecated warning will be detected, the middle one will produce a
-fatal error.
-
-
- use warning ;
+warnings from the category/categories specified that are detected in
+the lexical scope into fatal errors. In the code below, there are 3
+places where a deprecated warning will be detected, the middle one will
+produce a fatal error.
+
+
+ use warnings ;
$a = 1 if $a EQ $b ;
{
- use warning qw(FATAL deprecated) ;
+ use warnings FATAL => qw(deprecated) ;
$a = 1 if $a EQ $b ;
}
=head1 SEE ALSO
-L<warning>.
+L<warnings>.
=head1 AUTHOR
no integer;
no strict 'refs';
- no warning;
+ no warnings;
which lasts until the end of that BLOCK.
predeclare global variable names
-=item warning
+=item warnings
control optional warnings
control VMS-specific language features
-=item warning
-
-control optional warnings
-
=back
=head2 Standard Modules
C<__WARN__> hooks, as described in L<perlvar> and L<perlfunc/warn>.
See also L<perldiag> and L<perltrap>. A new, fine-grained warning
facility is also available if you want to manipulate entire classes
-of warnings; see L<warning> (or better yet, its source code) about
+of warnings; see L<warnings> (or better yet, its source code) about
that.
=item B<-W>
attrs, autouse, base, blib, constant, diagnostics, fields, filetest,
integer, less, lib, locale, ops, overload, re, sigtrap, strict, subs, utf8,
-vars, vmsish, warning
+vars, vmsish, warnings
=item Standard Modules
=item DESCRIPTION
-=head2 warning - Perl pragma to control optional warnings
+=head2 warnings - Perl pragma to control optional warnings
=item SYNOPSIS
See also the documentation of C<use VERSION> and C<require VERSION>
for a convenient way to fail if the running Perl interpreter is too old.
-=item $^B
-
-The current set of warning checks enabled by C<use warning>.
-See the documentation of C<warning> for more details.
-
-Used by lexical warnings to store the
-
=item $COMPILING
=item $^C
The current value of the warning switch, initially true if B<-w>
was used, false otherwise, but directly modifiable. (Mnemonic:
-related to the B<-w> switch.) See also L<warning>.
+related to the B<-w> switch.) See also L<warnings>.
+
+=item ${^Warnings}
+
+The current set of warning checks enabled by the C<use warnings> pragma.
+See the documentation of C<warnings> for more details.
=item $EXECUTABLE_NAME
not available.
See L<perlfunc/die>, L<perlfunc/warn>, L<perlfunc/eval>, and
-L<warning> for additional information.
+L<warnings> for additional information.
=back
# so that using > 0xfffffff constants and
# 32+ bit vector sizes doesn't cause noise
-no warning qw(overflow portable);
+no warnings qw(overflow portable);
print "1..39\n";
########
# strict behaviour, without any extra references
-use warning 'untie';
+use warnings 'untie';
#local $^W = 1 ;
use Tie::Hash ;
tie %h, Tie::StdHash;
########
# strict behaviour, with 1 extra references generating an error
-use warning 'untie';
+use warnings 'untie';
#local $^W = 1 ;
use Tie::Hash ;
$a = tie %h, Tie::StdHash;
########
# strict behaviour, with 1 extra references via tied generating an error
-use warning 'untie';
+use warnings 'untie';
#local $^W = 1 ;
use Tie::Hash ;
tie %h, Tie::StdHash;
########
# strict behaviour, with 1 extra references which are destroyed
-use warning 'untie';
+use warnings 'untie';
#local $^W = 1 ;
use Tie::Hash ;
$a = tie %h, Tie::StdHash;
########
# strict behaviour, with extra 1 references via tied which are destroyed
-use warning 'untie';
+use warnings 'untie';
#local $^W = 1 ;
use Tie::Hash ;
tie %h, Tie::StdHash;
########
# strict error behaviour, with 2 extra references
-use warning 'untie';
+use warnings 'untie';
#local $^W = 1 ;
use Tie::Hash ;
$a = tie %h, Tie::StdHash;
########
# strict behaviour, check scope of strictness.
-no warning 'untie';
+no warnings 'untie';
#local $^W = 0 ;
use Tie::Hash ;
$A = tie %H, Tie::StdHash;
$C = $B = tied %H ;
{
- use warning 'untie';
+ use warnings 'untie';
#local $^W = 1 ;
use Tie::Hash ;
tie %h, Tie::StdHash;
-Check lexical warning functionality
+Check lexical warnings functionality
TODO
check that the warning hierarchy works.
__END__
# check illegal category is caught
-use warning 'blah' ;
+use warnings 'blah' ;
EXPECT
unknown warning category 'blah' at - line 3
BEGIN failed--compilation aborted at - line 3.
########
# Check compile time scope of pragma
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
{
- no warning ;
+ no warnings ;
1 if $a EQ $b ;
}
1 if $a EQ $b ;
########
# Check compile time scope of pragma
-no warning;
+no warnings;
{
- use warning 'deprecated' ;
+ use warnings 'deprecated' ;
1 if $a EQ $b ;
}
1 if $a EQ $b ;
########
# Check runtime scope of pragma
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
{
- no warning ;
+ no warnings ;
my $b ; chop $b ;
}
my $b ; chop $b ;
########
# Check runtime scope of pragma
-no warning ;
+no warnings ;
{
- use warning 'uninitialized' ;
+ use warnings 'uninitialized' ;
my $b ; chop $b ;
}
my $b ; chop $b ;
########
# Check runtime scope of pragma
-no warning ;
+no warnings ;
{
- use warning 'uninitialized' ;
+ use warnings 'uninitialized' ;
$a = sub { my $b ; chop $b ; }
}
&$a ;
Use of uninitialized value at - line 6.
########
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
1 if $a EQ $b ;
EXPECT
Use of EQ is deprecated at - line 3.
1 if $a EQ $b ;
1;
--FILE--
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
require "./abc";
EXPECT
########
--FILE-- abc
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
1;
--FILE--
require "./abc";
########
--FILE-- abc
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
1 if $a EQ $b ;
1;
--FILE--
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
require "./abc";
my $a ; chop $a ;
EXPECT
########
--FILE-- abc.pm
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
1 if $a EQ $b ;
1;
--FILE--
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
use abc;
my $a ; chop $a ;
EXPECT
########
# Check scope of pragma with eval
-no warning ;
+no warnings ;
eval {
my $b ; chop $b ;
}; print STDERR $@ ;
########
# Check scope of pragma with eval
-no warning ;
+no warnings ;
eval {
- use warning 'uninitialized' ;
+ use warnings 'uninitialized' ;
my $b ; chop $b ;
}; print STDERR $@ ;
my $b ; chop $b ;
########
# Check scope of pragma with eval
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
eval {
my $b ; chop $b ;
}; print STDERR $@ ;
########
# Check scope of pragma with eval
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
eval {
- no warning ;
+ no warnings ;
my $b ; chop $b ;
}; print STDERR $@ ;
my $b ; chop $b ;
########
# Check scope of pragma with eval
-no warning ;
+no warnings ;
eval {
1 if $a EQ $b ;
}; print STDERR $@ ;
########
# Check scope of pragma with eval
-no warning ;
+no warnings ;
eval {
- use warning 'deprecated' ;
+ use warnings 'deprecated' ;
1 if $a EQ $b ;
}; print STDERR $@ ;
1 if $a EQ $b ;
########
# Check scope of pragma with eval
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
eval {
1 if $a EQ $b ;
}; print STDERR $@ ;
########
# Check scope of pragma with eval
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
eval {
- no warning ;
+ no warnings ;
1 if $a EQ $b ;
}; print STDERR $@ ;
1 if $a EQ $b ;
########
# Check scope of pragma with eval
-no warning ;
+no warnings ;
eval '
my $b ; chop $b ;
'; print STDERR $@ ;
########
# Check scope of pragma with eval
-no warning ;
+no warnings ;
eval q[
- use warning 'uninitialized' ;
+ use warnings 'uninitialized' ;
my $b ; chop $b ;
]; print STDERR $@;
my $b ; chop $b ;
########
# Check scope of pragma with eval
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
eval '
my $b ; chop $b ;
'; print STDERR $@ ;
########
# Check scope of pragma with eval
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
eval '
- no warning ;
+ no warnings ;
my $b ; chop $b ;
'; print STDERR $@ ;
my $b ; chop $b ;
########
# Check scope of pragma with eval
-no warning ;
+no warnings ;
eval '
1 if $a EQ $b ;
'; print STDERR $@ ;
########
# Check scope of pragma with eval
-no warning ;
+no warnings ;
eval q[
- use warning 'deprecated' ;
+ use warnings 'deprecated' ;
1 if $a EQ $b ;
]; print STDERR $@;
1 if $a EQ $b ;
########
# Check scope of pragma with eval
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
eval '
1 if $a EQ $b ;
'; print STDERR $@;
########
# Check scope of pragma with eval
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
eval '
- no warning ;
+ no warnings ;
1 if $a EQ $b ;
'; print STDERR $@;
1 if $a EQ $b ;
EXPECT
Use of EQ is deprecated at - line 8.
+########
+
+# Check the additive nature of the pragma
+1 if $a EQ $b ;
+my $a ; chop $a ;
+use warnings 'deprecated' ;
+1 if $a EQ $b ;
+my $b ; chop $b ;
+use warnings 'uninitialized' ;
+my $c ; chop $c ;
+no warnings 'deprecated' ;
+1 if $a EQ $b ;
+EXPECT
+Use of EQ is deprecated at - line 6.
+Use of uninitialized value at - line 9.
+Use of uninitialized value at - line 11.
+Use of uninitialized value at - line 11.
__END__
-# Check interaction of $^W and use warning
+# Check interaction of $^W and use warnings
sub fred {
- use warning ;
+ use warnings ;
my $b ;
chop $b ;
}
Use of uninitialized value at - line 6.
########
-# Check interaction of $^W and use warning
+# Check interaction of $^W and use warnings
sub fred {
- use warning ;
+ use warnings ;
my $b ;
chop $b ;
}
Use of uninitialized value at - line 6.
########
-# Check interaction of $^W and use warning
+# Check interaction of $^W and use warnings
sub fred {
- no warning ;
+ no warnings ;
my $b ;
chop $b ;
}
########
-# Check interaction of $^W and use warning
+# Check interaction of $^W and use warnings
sub fred {
- no warning ;
+ no warnings ;
my $b ;
chop $b ;
}
########
-# Check interaction of $^W and use warning
-use warning ;
+# Check interaction of $^W and use warnings
+use warnings ;
$^W = 1 ;
my $b ;
chop $b ;
Use of uninitialized value at - line 6.
########
-# Check interaction of $^W and use warning
+# Check interaction of $^W and use warnings
$^W = 1 ;
-use warning ;
+use warnings ;
my $b ;
chop $b ;
EXPECT
Use of uninitialized value at - line 6.
########
-# Check interaction of $^W and use warning
+# Check interaction of $^W and use warnings
$^W = 1 ;
-no warning ;
+no warnings ;
my $b ;
chop $b ;
EXPECT
########
-# Check interaction of $^W and use warning
-no warning ;
+# Check interaction of $^W and use warnings
+no warnings ;
$^W = 1 ;
my $b ;
chop $b ;
########
-w
-# Check interaction of $^W and use warning
-no warning ;
+# Check interaction of $^W and use warnings
+no warnings ;
my $b ;
chop $b ;
EXPECT
########
-w
-# Check interaction of $^W and use warning
-use warning ;
+# Check interaction of $^W and use warnings
+use warnings ;
my $b ;
chop $b ;
EXPECT
Use of uninitialized value at - line 5.
########
-# Check interaction of $^W and use warning
+# Check interaction of $^W and use warnings
sub fred {
- use warning ;
+ use warnings ;
my $b ;
chop $b ;
}
Use of uninitialized value at - line 6.
########
-# Check interaction of $^W and use warning
+# Check interaction of $^W and use warnings
sub fred {
- no warning ;
+ no warnings ;
my $b ;
chop $b ;
}
########
-# Check interaction of $^W and use warning
-use warning ;
+# Check interaction of $^W and use warnings
+use warnings ;
BEGIN { $^W = 1 }
my $b ;
chop $b ;
Use of uninitialized value at - line 6.
########
-# Check interaction of $^W and use warning
+# Check interaction of $^W and use warnings
BEGIN { $^W = 1 }
-use warning ;
+use warnings ;
my $b ;
chop $b ;
EXPECT
Use of uninitialized value at - line 6.
########
-# Check interaction of $^W and use warning
+# Check interaction of $^W and use warnings
BEGIN { $^W = 1 }
-no warning ;
+no warnings ;
my $b ;
chop $b ;
EXPECT
########
-# Check interaction of $^W and use warning
-no warning ;
+# Check interaction of $^W and use warnings
+no warnings ;
BEGIN { $^W = 1 }
my $b ;
chop $b ;
########
-# Check interaction of $^W and use warning
+# Check interaction of $^W and use warnings
BEGIN { $^W = 1 }
{
- no warning ;
+ no warnings ;
my $b ;
chop $b ;
}
Use of uninitialized value at - line 10.
########
-# Check interaction of $^W and use warning
+# Check interaction of $^W and use warnings
BEGIN { $^W = 0 }
{
- use warning ;
+ use warnings ;
my $b ;
chop $b ;
}
print on closed filehandle main::STDIN at - line 5.
########
-W
-# lint: check "no warning" is zapped
-no warning ;
+# lint: check "no warnings" is zapped
+no warnings ;
$a = $b = 1 ;
$a = 1 if $a EQ $b ;
close STDIN ; print STDIN "abc" ;
print on closed filehandle main::STDIN at - line 6.
########
-W
-# lint: check "no warning" is zapped
+# lint: check "no warnings" is zapped
{
- no warning ;
+ no warnings ;
close STDIN ; print STDIN "abc" ;
}
EXPECT
########
-W
--FILE-- abc.pm
-no warning 'deprecated' ;
+no warnings 'deprecated' ;
my ($a, $b) = (0,0);
1 if $a EQ $b ;
1;
--FILE--
-no warning 'uninitialized' ;
+no warnings 'uninitialized' ;
use abc;
my $a ; chop $a ;
EXPECT
########
-W
--FILE-- abc
-no warning 'deprecated' ;
+no warnings 'deprecated' ;
my ($a, $b) = (0,0);
1 if $a EQ $b ;
1;
--FILE--
-no warning 'uninitialized' ;
+no warnings 'uninitialized' ;
require "./abc";
my $a ; chop $a ;
EXPECT
EXPECT
########
-X
-# nolint: check "no warning" is zapped
-use warning ;
+# nolint: check "no warnings" is zapped
+use warnings ;
$a = $b = 1 ;
$a = 1 if $a EQ $b ;
close STDIN ; print STDIN "abc" ;
EXPECT
########
-X
-# nolint: check "no warning" is zapped
+# nolint: check "no warnings" is zapped
{
- use warning ;
+ use warnings ;
close STDIN ; print STDIN "abc" ;
}
EXPECT
########
-X
--FILE-- abc.pm
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
my ($a, $b) = (0,0);
1 if $a EQ $b ;
1;
--FILE--
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
use abc;
my $a ; chop $a ;
EXPECT
########
-X
--FILE-- abc
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
my ($a, $b) = (0,0);
1 if $a EQ $b ;
1;
--FILE--
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
require "./abc";
my $a ; chop $a ;
EXPECT
Check default warnings
__END__
-# default warning should be displayed if you don't add anything
+# default warnings should be displayed if you don't add anything
# optional shouldn't
my $a = oct "7777777777777777777777777777777777779" ;
EXPECT
Integer overflow in octal number at - line 3.
########
-# no warning should be displayed
-no warning ;
+# no warnings should be displayed
+no warnings ;
my $a = oct "7777777777777777777777777777777777778" ;
EXPECT
########
-# all warning should be displayed
-use warning ;
+# all warnings should be displayed
+use warnings ;
my $a = oct "7777777777777777777777777777777777778" ;
EXPECT
Integer overflow in octal number at - line 3.
Octal number > 037777777777 non-portable at - line 3.
########
# check scope
-use warning ;
+use warnings ;
my $a = oct "7777777777777777777777777777777777778" ;
{
- no warning ;
+ no warnings ;
my $a = oct "7777777777777777777777777777777777778" ;
}
my $c = oct "7777777777777777777777777777777777778" ;
Illegal octal digit '8' ignored at - line 8.
Octal number > 037777777777 non-portable at - line 8.
########
-# all warning should be displayed
-use warning ;
+# all warnings should be displayed
+use warnings ;
my $a = oct "0xfffffffffffffffffg" ;
EXPECT
Integer overflow in hexadecimal number at - line 3.
Illegal hexadecimal digit 'g' ignored at - line 3.
Hexadecimal number > 0xffffffff non-portable at - line 3.
########
-# all warning should be displayed
-use warning ;
+# all warnings should be displayed
+use warnings ;
my $a = oct "0b111111111111111111111111111111111111111111111111111111111111111112";
EXPECT
Integer overflow in binary number at - line 3.
--- /dev/null
+Check FATAL functionality
+
+__END__
+
+# Check compile time warning
+use warnings FATAL => 'deprecated' ;
+{
+ no warnings ;
+ 1 if $a EQ $b ;
+}
+1 if $a EQ $b ;
+print STDERR "The End.\n" ;
+EXPECT
+Use of EQ is deprecated at - line 8.
+########
+
+# Check runtime scope of pragma
+use warnings FATAL => 'uninitialized' ;
+{
+ no warnings ;
+ my $b ; chop $b ;
+}
+my $b ; chop $b ;
+print STDERR "The End.\n" ;
+EXPECT
+Use of uninitialized value at - line 8.
+########
+
+# Check runtime scope of pragma
+no warnings ;
+{
+ use warnings FATAL => 'uninitialized' ;
+ $a = sub { my $b ; chop $b ; }
+}
+&$a ;
+print STDERR "The End.\n" ;
+EXPECT
+Use of uninitialized value at - line 6.
+########
+
+--FILE-- abc
+1 if $a EQ $b ;
+1;
+--FILE--
+use warnings FATAL => 'deprecated' ;
+require "./abc";
+EXPECT
+
+########
+
+--FILE-- abc
+use warnings FATAL => 'deprecated' ;
+1;
+--FILE--
+require "./abc";
+1 if $a EQ $b ;
+EXPECT
+
+########
+
+--FILE-- abc
+use warnings 'deprecated' ;
+1 if $a EQ $b ;
+1;
+--FILE--
+use warnings FATAL => 'uninitialized' ;
+require "./abc";
+my $a ; chop $a ;
+print STDERR "The End.\n" ;
+EXPECT
+Use of EQ is deprecated at ./abc line 2.
+Use of uninitialized value at - line 3.
+########
+
+--FILE-- abc.pm
+use warnings 'deprecated' ;
+1 if $a EQ $b ;
+1;
+--FILE--
+use warnings FATAL => 'uninitialized' ;
+use abc;
+my $a ; chop $a ;
+print STDERR "The End.\n" ;
+EXPECT
+Use of EQ is deprecated at abc.pm line 2.
+Use of uninitialized value at - line 3.
+########
+
+# Check scope of pragma with eval
+no warnings ;
+eval {
+ use warnings FATAL => 'uninitialized' ;
+ my $b ; chop $b ;
+}; print STDERR "-- $@" ;
+my $b ; chop $b ;
+print STDERR "The End.\n" ;
+EXPECT
+-- Use of uninitialized value at - line 6.
+The End.
+########
+
+# Check scope of pragma with eval
+use warnings FATAL => 'uninitialized' ;
+eval {
+ my $b ; chop $b ;
+}; print STDERR "-- $@" ;
+my $b ; chop $b ;
+print STDERR "The End.\n" ;
+EXPECT
+-- Use of uninitialized value at - line 5.
+Use of uninitialized value at - line 7.
+########
+
+# Check scope of pragma with eval
+use warnings FATAL => 'uninitialized' ;
+eval {
+ no warnings ;
+ my $b ; chop $b ;
+}; print STDERR $@ ;
+my $b ; chop $b ;
+print STDERR "The End.\n" ;
+EXPECT
+Use of uninitialized value at - line 8.
+########
+
+# Check scope of pragma with eval
+no warnings ;
+eval {
+ use warnings FATAL => 'deprecated' ;
+ 1 if $a EQ $b ;
+}; print STDERR "-- $@" ;
+1 if $a EQ $b ;
+print STDERR "The End.\n" ;
+EXPECT
+Use of EQ is deprecated at - line 6.
+########
+
+# Check scope of pragma with eval
+use warnings FATAL => 'deprecated' ;
+eval {
+ 1 if $a EQ $b ;
+}; print STDERR "-- $@" ;
+1 if $a EQ $b ;
+print STDERR "The End.\n" ;
+EXPECT
+Use of EQ is deprecated at - line 5.
+########
+
+# Check scope of pragma with eval
+use warnings FATAL => 'deprecated' ;
+eval {
+ no warnings ;
+ 1 if $a EQ $b ;
+}; print STDERR $@ ;
+1 if $a EQ $b ;
+print STDERR "The End.\n" ;
+EXPECT
+Use of EQ is deprecated at - line 8.
+########
+
+# Check scope of pragma with eval
+no warnings ;
+eval {
+ use warnings FATAL => 'deprecated' ;
+}; print STDERR $@ ;
+1 if $a EQ $b ;
+print STDERR "The End.\n" ;
+EXPECT
+The End.
+########
+
+# Check scope of pragma with eval
+no warnings ;
+eval q[
+ use warnings FATAL => 'uninitialized' ;
+ my $b ; chop $b ;
+]; print STDERR "-- $@";
+my $b ; chop $b ;
+print STDERR "The End.\n" ;
+EXPECT
+-- Use of uninitialized value at (eval 1) line 3.
+The End.
+########
+
+# Check scope of pragma with eval
+use warnings FATAL => 'uninitialized' ;
+eval '
+ my $b ; chop $b ;
+'; print STDERR "-- $@" ;
+my $b ; chop $b ;
+print STDERR "The End.\n" ;
+EXPECT
+-- Use of uninitialized value at (eval 1) line 2.
+Use of uninitialized value at - line 7.
+########
+
+# Check scope of pragma with eval
+use warnings FATAL => 'uninitialized' ;
+eval '
+ no warnings ;
+ my $b ; chop $b ;
+'; print STDERR $@ ;
+my $b ; chop $b ;
+print STDERR "The End.\n" ;
+EXPECT
+Use of uninitialized value at - line 8.
+########
+
+# Check scope of pragma with eval
+no warnings ;
+eval q[
+ use warnings FATAL => 'deprecated' ;
+ 1 if $a EQ $b ;
+]; print STDERR "-- $@";
+1 if $a EQ $b ;
+print STDERR "The End.\n" ;
+EXPECT
+-- Use of EQ is deprecated at (eval 1) line 3.
+The End.
+########
+
+# Check scope of pragma with eval
+use warnings FATAL => 'deprecated' ;
+eval '
+ 1 if $a EQ $b ;
+'; print STDERR "-- $@";
+print STDERR "The End.\n" ;
+EXPECT
+-- Use of EQ is deprecated at (eval 1) line 2.
+The End.
+########
+
+# Check scope of pragma with eval
+use warnings FATAL => 'deprecated' ;
+eval '
+ no warnings ;
+ 1 if $a EQ $b ;
+'; print STDERR "-- $@";
+1 if $a EQ $b ;
+print STDERR "The End.\n" ;
+EXPECT
+Use of EQ is deprecated at - line 8.
--- /dev/null
+Check interaction of __WARN__, __DIE__ & lexical Warnings
+
+TODO
+
+__END__
+# 8signal
+BEGIN { $SIG{__WARN__} = sub { print "WARN -- @_" } }
+BEGIN { $SIG{__DIE__} = sub { print "DIE -- @_" } }
+1 if 1 EQ 2 ;
+use warnings qw(deprecated) ;
+1 if 1 EQ 2 ;
+use warnings FATAL => qw(deprecated) ;
+1 if 1 EQ 2 ;
+print "The End.\n" ;
+EXPECT
+Use of EQ is deprecated at - line 8.
+WARN -- Use of EQ is deprecated at - line 6.
+DIE -- Use of EQ is deprecated at - line 8.
__END__
# doio.c
-use warning 'io' ;
+use warnings 'io' ;
open(F, '|'.($^O eq 'VMS' ? 'mcr ':'')."$^X -e 1|");
close(F);
-no warning 'io' ;
+no warnings 'io' ;
open(G, '|'.($^O eq 'VMS' ? 'mcr ':'')."$^X -e 1|");
close(G);
EXPECT
Can't do bidirectional pipe at - line 3.
########
# doio.c
-use warning 'io' ;
+use warnings 'io' ;
open(F, "| ");
-no warning 'io' ;
+no warnings 'io' ;
open(G, "| ");
EXPECT
Missing command in piped open at - line 3.
########
# doio.c
-use warning 'io' ;
+use warnings 'io' ;
open(F, " |");
-no warning 'io' ;
+no warnings 'io' ;
open(G, " |");
EXPECT
Missing command in piped open at - line 3.
########
# doio.c
-use warning 'io' ;
+use warnings 'io' ;
open(F, "<true\ncd");
-no warning 'io' ;
+no warnings 'io' ;
open(G, "<true\ncd");
EXPECT
Unsuccessful open on filename containing newline at - line 3.
########
# doio.c
-use warning 'io' ;
+use warnings 'io' ;
close STDIN ;
tell(STDIN);
$a = seek(STDIN,1,1);
$a = sysseek(STDIN,1,1);
-x STDIN ;
-no warning 'io' ;
+no warnings 'io' ;
close STDIN ;
tell(STDIN);
$a = seek(STDIN,1,1);
Stat on unopened file <STDIN> at - line 7.
########
# doio.c
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
print $a ;
-no warning 'uninitialized' ;
+no warnings 'uninitialized' ;
print $b ;
EXPECT
Use of uninitialized value at - line 3.
########
# doio.c
-use warning 'io' ;
+use warnings 'io' ;
EXPECT
########
# doio.c
-use warning 'io' ;
+use warnings 'io' ;
stat "ab\ncd";
lstat "ab\ncd";
-no warning 'io' ;
+no warnings 'io' ;
stat "ab\ncd";
lstat "ab\ncd";
EXPECT
Unsuccessful stat on filename containing newline at - line 4.
########
# doio.c
-use warning 'io' ;
+use warnings 'io' ;
exec "lskdjfalksdjfdjfkls","" ;
-no warning 'io' ;
+no warnings 'io' ;
exec "lskdjfalksdjfdjfkls","" ;
EXPECT
OPTION regex
Can't exec "lskdjfalksdjfdjfkls": .+
########
# doio.c
-use warning 'io' ;
+use warnings 'io' ;
exec "lskdjfalksdjfdjfkls", "abc" ;
-no warning 'io' ;
+no warnings 'io' ;
exec "lskdjfalksdjfdjfkls", "abc" ;
EXPECT
OPTION regex
my $x = <> ;
}
{
- no warning 'inplace' ;
+ no warnings 'inplace' ;
local (@ARGV) = ($filename) ;
local ($^I) = "" ;
my $x = <> ;
}
{
- use warning 'inplace' ;
+ use warnings 'inplace' ;
local (@ARGV) = ($filename) ;
local ($^I) = "" ;
my $x = <> ;
Malformed UTF-8 character at - line 4.
########
# doop.c
-use warning 'utf8' ;
+use warnings 'utf8' ;
use utf8 ;
$_ = "\x80 \xff" ;
chop ;
-no warning 'utf8' ;
+no warnings 'utf8' ;
$_ = "\x80 \xff" ;
chop ;
EXPECT
__END__
# gv.c
-use warning 'misc' ;
+use warnings 'misc' ;
@ISA = qw(Fred); joe()
EXPECT
Can't locate package Fred for @main::ISA at - line 3.
Undefined subroutine &main::joe called at - line 3.
########
# gv.c
-no warning 'misc' ;
+no warnings 'misc' ;
@ISA = qw(Fred); joe()
EXPECT
Undefined subroutine &main::joe called at - line 3.
# gv.c
sub Other::AUTOLOAD { 1 } sub Other::fred {}
@ISA = qw(Other) ;
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
fred() ;
EXPECT
Use of inherited AUTOLOAD for non-method main::fred() is deprecated at - line 5.
########
# gv.c
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
$a = ${"#"};
$a = ${"*"};
-no warning 'deprecated' ;
+no warnings 'deprecated' ;
$a = ${"#"};
$a = ${"*"};
EXPECT
__END__
# mg.c
-use warning 'signal' ;
+use warnings 'signal' ;
$SIG{FRED} = sub {};
EXPECT
No such signal: SIGFRED at - line 3.
########
# mg.c
-no warning 'signal' ;
+no warnings 'signal' ;
$SIG{FRED} = sub {};
EXPECT
########
# mg.c
-use warning 'signal' ;
+use warnings 'signal' ;
if ($^O eq 'MSWin32' || $^O eq 'VMS') {
print "SKIPPED\n# $^O, can't kill() to raise()\n"; exit;
}
SIGINT handler "fred" not defined.
########
# mg.c
-no warning 'signal' ;
+no warnings 'signal' ;
if ($^O eq 'MSWin32' || $^O eq 'VMS') {
print "SKIPPED\n# win32, can't kill() to raise()\n"; exit;
}
local $a, $b = (1,2);
Probable precedence problem on logical or at -e line 1.
- use warning 'syntax'; my $x = print(ABC || 1);
+ use warnings 'syntax'; my $x = print(ABC || 1);
Value of %s may be \"0\"; use \"defined\"
$x = 1 if $x = <FH> ;
__END__
# op.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
my $x ;
my $x ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
my $x ;
EXPECT
"my" variable $x masks earlier declaration in same scope at - line 4.
########
# op.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
sub x {
my $x;
sub y {
Variable "$x" will not stay shared at - line 7.
########
# op.c
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
sub x {
my $x;
sub y {
########
# op.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
sub x {
my $x;
sub y {
Variable "$x" may be unavailable at - line 6.
########
# op.c
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
sub x {
my $x;
sub y {
########
# op.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
1 if $a = 1 ;
-no warning 'syntax' ;
+no warnings 'syntax' ;
1 if $a = 1 ;
EXPECT
Found = in conditional, should be == at - line 3.
########
# op.c
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
split ;
-no warning 'deprecated' ;
+no warnings 'deprecated' ;
split ;
EXPECT
Use of implicit split to @_ is deprecated at - line 3.
########
# op.c
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
$a = split ;
-no warning 'deprecated' ;
+no warnings 'deprecated' ;
$a = split ;
EXPECT
Use of implicit split to @_ is deprecated at - line 3.
########
# op.c
-use warning 'void' ; close STDIN ;
+use warnings 'void' ; close STDIN ;
1 x 3 ; # OP_REPEAT
# OP_GVSV
wantarray ; # OP_WANTARRAY
Useless use of getpwuid in void context at - line 53.
########
# op.c
-no warning 'void' ; close STDIN ;
+no warnings 'void' ; close STDIN ;
1 x 3 ; # OP_REPEAT
# OP_GVSV
wantarray ; # OP_WANTARRAY
EXPECT
########
# op.c
-use warning 'void' ;
+use warnings 'void' ;
for (@{[0]}) { "$_" } # check warning isn't duplicated
-no warning 'void' ;
+no warnings 'void' ;
for (@{[0]}) { "$_" } # check warning isn't duplicated
EXPECT
Useless use of string in void context at - line 3.
########
# op.c
-use warning 'void' ;
+use warnings 'void' ;
use Config ;
BEGIN {
if ( ! $Config{d_telldir}) {
}
}
telldir 1 ; # OP_TELLDIR
-no warning 'void' ;
+no warnings 'void' ;
telldir 1 ; # OP_TELLDIR
EXPECT
Useless use of telldir in void context at - line 13.
########
# op.c
-use warning 'void' ;
+use warnings 'void' ;
use Config ;
BEGIN {
if ( ! $Config{d_getppid}) {
}
}
getppid ; # OP_GETPPID
-no warning 'void' ;
+no warnings 'void' ;
getppid ; # OP_GETPPID
EXPECT
Useless use of getppid in void context at - line 13.
########
# op.c
-use warning 'void' ;
+use warnings 'void' ;
use Config ;
BEGIN {
if ( ! $Config{d_getpgrp}) {
}
}
getpgrp ; # OP_GETPGRP
-no warning 'void' ;
+no warnings 'void' ;
getpgrp ; # OP_GETPGRP
EXPECT
Useless use of getpgrp in void context at - line 13.
########
# op.c
-use warning 'void' ;
+use warnings 'void' ;
use Config ;
BEGIN {
if ( ! $Config{d_times}) {
}
}
times ; # OP_TMS
-no warning 'void' ;
+no warnings 'void' ;
times ; # OP_TMS
EXPECT
Useless use of times in void context at - line 13.
########
# op.c
-use warning 'void' ;
+use warnings 'void' ;
use Config ;
BEGIN {
if ( ! $Config{d_getprior} or $^O eq 'os2') { # Locks before fixpak22
}
}
getpriority 1,2; # OP_GETPRIORITY
-no warning 'void' ;
+no warnings 'void' ;
getpriority 1,2; # OP_GETPRIORITY
EXPECT
Useless use of getpriority in void context at - line 13.
########
# op.c
-use warning 'void' ;
+use warnings 'void' ;
use Config ;
BEGIN {
if ( ! $Config{d_getlogin}) {
}
}
getlogin ; # OP_GETLOGIN
-no warning 'void' ;
+no warnings 'void' ;
getlogin ; # OP_GETLOGIN
EXPECT
Useless use of getlogin in void context at - line 13.
########
# op.c
-use warning 'void' ;
+use warnings 'void' ;
use Config ; BEGIN {
if ( ! $Config{d_socket}) {
print <<EOM ;
getservbyport 1,2; # OP_GSBYPORT
getservent ; # OP_GSERVENT
-no warning 'void' ;
+no warnings 'void' ;
getsockname STDIN ; # OP_GETSOCKNAME
getpeername STDIN ; # OP_GETPEERNAME
gethostbyname 1 ; # OP_GHBYNAME
Useless use of getservent in void context at - line 37.
########
# op.c
-use warning 'void' ;
+use warnings 'void' ;
*a ; # OP_RV2GV
$a ; # OP_RV2SV
@a ; # OP_RV2AV
%a ; # OP_RV2HV
-no warning 'void' ;
+no warnings 'void' ;
*a ; # OP_RV2GV
$a ; # OP_RV2SV
@a ; # OP_RV2AV
Useless use of a variable in void context at - line 6.
########
# op.c
-use warning 'void' ;
+use warnings 'void' ;
"abc"; # OP_CONST
7 ; # OP_CONST
-no warning 'void' ;
+no warnings 'void' ;
"abc"; # OP_CONST
7 ; # OP_CONST
EXPECT
########
# op.c
$ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3; # known scalar leak
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ;
@a =~ /abc/ ;
@a =~ s/a/b/ ;
%$c =~ s/a/b/ ;
%$c =~ tr/a/b/ ;
{
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ;
@a =~ /abc/ ;
@a =~ s/a/b/ ;
BEGIN not safe after errors--compilation aborted at - line 18.
########
# op.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
my $a, $b = (1,2);
-no warning 'syntax' ;
+no warnings 'syntax' ;
my $c, $d = (1,2);
EXPECT
Parentheses missing around "my" list at - line 3.
########
# op.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
local $a, $b = (1,2);
-no warning 'syntax' ;
+no warnings 'syntax' ;
local $c, $d = (1,2);
EXPECT
Parentheses missing around "local" list at - line 3.
########
# op.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
print (ABC || 1) ;
-no warning 'syntax' ;
+no warnings 'syntax' ;
print (ABC || 1) ;
EXPECT
Probable precedence problem on logical or at - line 3.
--FILE--
# op.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
open FH, "<abc" ;
$x = 1 if $x = <FH> ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
$x = 1 if $x = <FH> ;
EXPECT
Value of <HANDLE> construct can be "0"; test with defined() at - line 4.
########
# op.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
opendir FH, "." ;
$x = 1 if $x = readdir FH ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
$x = 1 if $x = readdir FH ;
closedir FH ;
EXPECT
Value of readdir() operator can be "0"; test with defined() at - line 4.
########
# op.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
$x = 1 if $x = <*> ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
$x = 1 if $x = <*> ;
EXPECT
Value of glob construct can be "0"; test with defined() at - line 3.
########
# op.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
%a = (1,2,3,4) ;
$x = 1 if $x = each %a ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
$x = 1 if $x = each %a ;
EXPECT
Value of each() operator can be "0"; test with defined() at - line 4.
########
# op.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
$x = 1 while $x = <*> and 0 ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
$x = 1 while $x = <*> and 0 ;
EXPECT
Value of glob construct can be "0"; test with defined() at - line 3.
########
# op.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
opendir FH, "." ;
$x = 1 while $x = readdir FH and 0 ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
$x = 1 while $x = readdir FH and 0 ;
closedir FH ;
EXPECT
Value of readdir() operator can be "0"; test with defined() at - line 4.
########
# op.c
-use warning 'redefine' ;
+use warnings 'redefine' ;
sub fred {}
sub fred {}
-no warning 'redefine' ;
+no warnings 'redefine' ;
sub fred {}
EXPECT
Subroutine fred redefined at - line 4.
########
# op.c
-use warning 'redefine' ;
+use warnings 'redefine' ;
sub fred () { 1 }
sub fred () { 1 }
-no warning 'redefine' ;
+no warnings 'redefine' ;
sub fred () { 1 }
EXPECT
Constant subroutine fred redefined at - line 4.
########
# op.c
-use warning 'redefine' ;
+use warnings 'redefine' ;
format FRED =
.
format FRED =
.
-no warning 'redefine' ;
+no warnings 'redefine' ;
format FRED =
.
EXPECT
Format FRED redefined at - line 5.
########
# op.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
push FRED;
-no warning 'syntax' ;
+no warnings 'syntax' ;
push FRED;
EXPECT
Array @FRED missing the @ in argument 1 of push() at - line 3.
########
# op.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
@a = keys FRED ;
-no warning 'syntax' ;
+no warnings 'syntax' ;
@a = keys FRED ;
EXPECT
Hash %FRED missing the % in argument 1 of keys() at - line 3.
########
# op.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
exec "$^X -e 1" ;
my $a
EXPECT
(Maybe you meant system() when you said exec()?)
########
# op.c
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
my @a; defined(@a);
EXPECT
defined(@array) is deprecated at - line 3.
(Maybe you should just omit the defined()?)
########
# op.c
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
defined(@a = (1,2,3));
EXPECT
defined(@array) is deprecated at - line 3.
(Maybe you should just omit the defined()?)
########
# op.c
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
my %h; defined(%h);
EXPECT
defined(%hash) is deprecated at - line 3.
(Maybe you should just omit the defined()?)
########
# op.c
-no warning 'syntax' ;
+no warnings 'syntax' ;
exec "$^X -e 1" ;
my $a
EXPECT
sub fred() ;
sub fred($) {}
{
- no warning 'unsafe' ;
+ no warnings 'unsafe' ;
sub Fred() ;
sub Fred($) {}
- use warning 'unsafe' ;
+ use warnings 'unsafe' ;
sub freD() ;
sub freD($) {}
}
__END__
# perl.c
-no warning 'once' ;
+no warnings 'once' ;
$x = 3 ;
-use warning 'once' ;
+use warnings 'once' ;
$z = 3 ;
EXPECT
Name "main::z" used only once: possible typo at - line 5.
-w
# perl.c
$x = 3 ;
-no warning 'once' ;
+no warnings 'once' ;
$z = 3
EXPECT
Name "main::x" used only once: possible typo at - line 3.
# perl.c
BEGIN { $^W =1 ; }
$x = 3 ;
-no warning 'once' ;
+no warnings 'once' ;
$z = 3
EXPECT
Name "main::x" used only once: possible typo at - line 3.
########
-W
# perl.c
-no warning 'once' ;
+no warnings 'once' ;
$x = 3 ;
-use warning 'once' ;
+use warnings 'once' ;
$z = 3 ;
EXPECT
Name "main::x" used only once: possible typo at - line 4.
########
-X
# perl.c
-use warning 'once' ;
+use warnings 'once' ;
$x = 3 ;
EXPECT
__END__
# perly.y
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
sub fred {}
do fred() ;
do fred(1) ;
$a = "fred" ;
do $a() ;
do $a(1) ;
-no warning 'deprecated' ;
+no warnings 'deprecated' ;
do fred() ;
do fred(1) ;
$a = "fred" ;
__END__
# pp.c
-use warning 'substr' ;
+use warnings 'substr' ;
$a = "ab" ;
$a = substr($a, 4,5);
-no warning 'substr' ;
+no warnings 'substr' ;
$a = "ab" ;
$a = substr($a, 4,5);
EXPECT
substr outside of string at - line 4.
########
# pp.c
-use warning 'substr' ;
+use warnings 'substr' ;
$a = "ab" ;
$b = \$a ;
substr($b, 1,1) = "ab" ;
-no warning 'substr' ;
+no warnings 'substr' ;
substr($b, 1,1) = "ab" ;
EXPECT
Attempt to use reference as lvalue in substr at - line 5.
########
# pp.c
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
# TODO
EXPECT
########
# pp.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
my $a = { 1,2,3};
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
my $b = { 1,2,3};
EXPECT
Odd number of elements in hash assignment at - line 3.
########
# pp.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
my @a = unpack ("A,A", "22") ;
my $a = pack ("A,A", 1,2) ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
my @b = unpack ("A,A", "22") ;
my $b = pack ("A,A", 1,2) ;
EXPECT
Invalid type in pack: ',' at - line 4.
########
# pp.c
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
my $a = undef ;
my $b = $$a;
-no warning 'uninitialized' ;
+no warnings 'uninitialized' ;
my $c = $$a;
EXPECT
Use of uninitialized value at - line 4.
########
# pp.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
sub foo { my $a = "a"; return $a . $a++ . $a++ }
my $a = pack("p", &foo) ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
my $b = pack("p", &foo) ;
EXPECT
Attempt to pack pointer to temporary value at - line 4.
########
# pp.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
bless \[], "" ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
bless \[], "" ;
EXPECT
Explicit blessing to '' (assuming package main) at - line 3.
Malformed UTF-8 character at - line 4.
########
# pp.c
-use warning 'utf8' ;
+use warnings 'utf8' ;
use utf8 ;
$_ = "\x80 \xff" ;
reverse ;
-no warning 'utf8' ;
+no warnings 'utf8' ;
$_ = "\x80 \xff" ;
reverse ;
EXPECT
__END__
# pp_ctl.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
format STDOUT =
@<<< @<<<
1
1
########
# pp_ctl.c
-no warning 'syntax' ;
+no warnings 'syntax' ;
format =
@<<< @<<<
1
1
########
# pp_ctl.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
$_ = "abc" ;
while ($i ++ == 0)
{
s/ab/last/e ;
}
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
while ($i ++ == 0)
{
s/ab/last/e ;
Exiting substitution via last at - line 7.
########
# pp_ctl.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
sub fred { last }
{ fred() }
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
sub joe { last }
{ joe() }
EXPECT
########
# pp_ctl.c
{
- eval "use warning 'unsafe' ; last;"
+ eval "use warnings 'unsafe' ; last;"
}
print STDERR $@ ;
{
- eval "no warning 'unsafe' ;last;"
+ eval "no warnings 'unsafe' ;last;"
}
print STDERR $@ ;
EXPECT
Exiting eval via last at (eval 1) line 1.
########
# pp_ctl.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
@a = (1,2) ;
@b = sort { last } @a ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
@b = sort { last } @a ;
EXPECT
Exiting pseudo-block via last at - line 4.
Can't "last" outside a block at - line 4.
########
# pp_ctl.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
$_ = "abc" ;
fred:
while ($i ++ == 0)
{
s/ab/last fred/e ;
}
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
while ($i ++ == 0)
{
s/ab/last fred/e ;
Exiting substitution via last at - line 7.
########
# pp_ctl.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
sub fred { last joe }
joe: { fred() }
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
sub Fred { last Joe }
Joe: { Fred() }
EXPECT
########
# pp_ctl.c
joe:
-{ eval "use warning 'unsafe' ; last joe;" }
+{ eval "use warnings 'unsafe' ; last joe;" }
print STDERR $@ ;
Joe:
-{ eval "no warning 'unsafe' ; last Joe;" }
+{ eval "no warnings 'unsafe' ; last Joe;" }
print STDERR $@ ;
EXPECT
Exiting eval via last at (eval 1) line 1.
########
# pp_ctl.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
@a = (1,2) ;
fred: @b = sort { last fred } @a ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
Fred: @b = sort { last Fred } @a ;
EXPECT
Exiting pseudo-block via last at - line 4.
Label not found for "last fred" at - line 4.
########
# pp_ctl.c
-use warning 'recursion' ;
+use warnings 'recursion' ;
BEGIN { warn "PREFIX\n" ;}
sub fred
{
Deep recursion on subroutine "main::fred" at - line 6.
########
# pp_ctl.c
-no warning 'recursion' ;
+no warnings 'recursion' ;
BEGIN { warn "PREFIX\n" ;}
sub fred
{
Can't find label
########
# pp_ctl.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
package Foo;
DESTROY { die "@{$_[0]} foo bar" }
{ bless ['A'], 'Foo' for 1..10 }
(in cleanup) B foo bar at - line 4.
########
# pp_ctl.c
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
package Foo;
DESTROY { die "@{$_[0]} foo bar" }
{ bless ['A'], 'Foo' for 1..10 }
__END__
# pp_hot.c
-use warning 'unopened' ;
+use warnings 'unopened' ;
$f = $a = "abc" ;
print $f $a;
-no warning 'unopened' ;
+no warnings 'unopened' ;
print $f $a;
EXPECT
Filehandle main::abc never opened at - line 4.
########
# pp_hot.c
-use warning 'io' ;
+use warnings 'io' ;
print STDIN "anc";
print <STDOUT>;
print <STDERR>;
print getc(STDERR);
print getc(FOO);
read(FOO,$_,1);
-no warning 'io' ;
+no warnings 'io' ;
print STDIN "anc";
####################################################################
# N O T E #
Filehandle main::FOO opened only for output at - line 9.
########
# pp_hot.c
-use warning 'closed' ;
+use warnings 'closed' ;
close STDIN ;
print STDIN "anc";
-no warning 'closed' ;
+no warnings 'closed' ;
print STDIN "anc";
EXPECT
print on closed filehandle main::STDIN at - line 4.
########
# pp_hot.c
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
my $a = undef ;
my @b = @$a;
-no warning 'uninitialized' ;
+no warnings 'uninitialized' ;
my @c = @$a;
EXPECT
Use of uninitialized value at - line 4.
########
# pp_hot.c
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
my $a = undef ;
my %b = %$a;
-no warning 'uninitialized' ;
+no warnings 'uninitialized' ;
my %c = %$a;
EXPECT
Use of uninitialized value at - line 4.
########
# pp_hot.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
my %X ; %X = (1,2,3) ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
my %Y ; %Y = (1,2,3) ;
EXPECT
Odd number of elements in hash assignment at - line 3.
########
# pp_hot.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
my %X ; %X = [1 .. 3] ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
my %Y ; %Y = [1 .. 3] ;
EXPECT
Reference found where even-sized list expected at - line 3.
########
# pp_hot.c
-use warning 'closed' ;
+use warnings 'closed' ;
close STDIN ; $a = <STDIN> ;
-no warning 'closed' ;
+no warnings 'closed' ;
$a = <STDIN> ;
EXPECT
Read on closed filehandle main::STDIN at - line 3.
########
# pp_hot.c
-use warning 'recursion' ;
+use warnings 'recursion' ;
sub fred
{
fred() if $a++ < 200
ok
########
# pp_hot.c
-no warning 'recursion' ;
+no warnings 'recursion' ;
sub fred
{
fred() if $a++ < 200
########
# pp_hot.c
-use warning 'recursion' ;
+use warnings 'recursion' ;
$b = sub
{
&$b if $a++ < 200
Deep recursion on anonymous subroutine at - line 5.
########
# pp_hot.c
-no warning 'recursion' ;
+no warnings 'recursion' ;
$b = sub
{
&$b if $a++ < 200
__END__
# pp_sys.c
-use warning 'untie' ;
+use warnings 'untie' ;
sub TIESCALAR { bless [] } ;
$b = tie $a, 'main';
untie $a ;
-no warning 'untie' ;
+no warnings 'untie' ;
$c = tie $d, 'main';
untie $d ;
EXPECT
untie attempted while 1 inner references still exist at - line 5.
########
# pp_sys.c
-use warning 'io' ;
+use warnings 'io' ;
format STDIN =
.
write STDIN;
-no warning 'io' ;
+no warnings 'io' ;
write STDIN;
EXPECT
Filehandle main::STDIN opened only for input at - line 5.
########
# pp_sys.c
-use warning 'closed' ;
+use warnings 'closed' ;
format STDIN =
.
close STDIN;
write STDIN;
-no warning 'closed' ;
+no warnings 'closed' ;
write STDIN;
EXPECT
Write on closed filehandle main::STDIN at - line 6.
########
# pp_sys.c
-use warning 'io' ;
+use warnings 'io' ;
format STDOUT_TOP =
abc
.
$- =1 ;
open STDOUT, ">".($^O eq 'VMS'? 'NL:' : '/dev/null') ;
write ;
-no warning 'io' ;
+no warnings 'io' ;
write ;
EXPECT
page overflow at - line 13.
########
# pp_sys.c
-use warning 'unopened' ;
+use warnings 'unopened' ;
$a = "abc";
printf $a "fred";
-no warning 'unopened' ;
+no warnings 'unopened' ;
printf $a "fred";
EXPECT
Filehandle main::abc never opened at - line 4.
########
# pp_sys.c
-use warning 'closed' ;
+use warnings 'closed' ;
close STDIN ;
printf STDIN "fred";
-no warning 'closed' ;
+no warnings 'closed' ;
printf STDIN "fred";
EXPECT
printf on closed filehandle main::STDIN at - line 4.
########
# pp_sys.c
-use warning 'io' ;
+use warnings 'io' ;
printf STDIN "fred";
-no warning 'io' ;
+no warnings 'io' ;
printf STDIN "fred";
EXPECT
Filehandle main::STDIN opened only for input at - line 3.
########
# pp_sys.c
-use warning 'closed' ;
+use warnings 'closed' ;
close STDIN;
syswrite STDIN, "fred", 1;
-no warning 'closed' ;
+no warnings 'closed' ;
syswrite STDIN, "fred", 1;
EXPECT
Syswrite on closed filehandle at - line 4.
########
# pp_sys.c
-use warning 'io' ;
+use warnings 'io' ;
use Config;
BEGIN {
if ( $^O ne 'VMS' and ! $Config{d_socket}) {
getsockopt STDIN, 1,2;
getsockname STDIN;
getpeername STDIN;
-no warning 'io' ;
+no warnings 'io' ;
send STDIN, "fred", 1;
bind STDIN, "fred" ;
connect STDIN, "fred" ;
get{sock, peer}name() on closed fd at - line 31.
########
# pp_sys.c
-use warning 'newline' ;
+use warnings 'newline' ;
stat "abc\ndef";
-no warning 'newline' ;
+no warnings 'newline' ;
stat "abc\ndef";
EXPECT
Unsuccessful stat on filename containing newline at - line 3.
########
# pp_sys.c
-use warning 'unopened' ;
+use warnings 'unopened' ;
close STDIN ;
-T STDIN ;
-no warning 'unopened' ;
+no warnings 'unopened' ;
-T STDIN ;
EXPECT
Test on unopened file <STDIN> at - line 4.
########
# pp_sys.c
-use warning 'newline' ;
+use warnings 'newline' ;
-T "abc\ndef" ;
-no warning 'newline' ;
+no warnings 'newline' ;
-T "abc\ndef" ;
EXPECT
Unsuccessful open on filename containing newline at - line 3.
__END__
# regcomp.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
my $a = "ABC123" ;
$a =~ /(?=a)*/ ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
$a =~ /(?=a)*/ ;
EXPECT
(?=a)* matches null string many times at - line 4.
########
# regcomp.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
$_ = "" ;
/(?=a)?/;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
/(?=a)?/;
EXPECT
Strange *+?{} on zero-length expression at - line 4.
########
# regcomp.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
$_ = "" ;
/[:alpha:]/;
/[.bar.]/;
/[[.foo.]]/;
/[[=bar=]]/;
/[:zog:]/;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
/[:alpha:]/;
/[.foo.]/;
/[=bar=]/;
__END__
# regexec.c
print("SKIPPED\n# most systems run into stacksize limits\n"),exit;
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
$SIG{__WARN__} = sub{local ($m) = shift;
$m =~ s/\(\d+\)/(*MASKED*)/;
print STDERR $m};
########
# regexec.c
print("SKIPPED\n# most systems run into stacksize limits\n"),exit;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
$SIG{__WARN__} = sub{local ($m) = shift;
$m =~ s/\(\d+\)/(*MASKED*)/;
print STDERR $m};
########
# regexec.c
print("SKIPPED\n# most systems run into stacksize limits\n"),exit;
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
$SIG{__WARN__} = sub{local ($m) = shift;
$m =~ s/\(\d+\)/(*MASKED*)/;
print STDERR $m};
########
# regexec.c
print("SKIPPED\n# most systems run into stacksize limits\n"),exit;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
$SIG{__WARN__} = sub{local ($m) = shift;
$m =~ s/\(\d+\)/(*MASKED*)/;
print STDERR $m};
__END__
# sv.c
use integer ;
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
$x = 1 + $a[0] ; # a
-no warning 'uninitialized' ;
+no warnings 'uninitialized' ;
$x = 1 + $b[0] ; # a
EXPECT
Use of uninitialized value at - line 4.
package main ;
tie $A, 'fred' ;
use integer ;
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
$A *= 2 ;
-no warning 'uninitialized' ;
+no warnings 'uninitialized' ;
$A *= 2 ;
EXPECT
Use of uninitialized value at - line 10.
########
# sv.c
use integer ;
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
my $x *= 2 ; #b
-no warning 'uninitialized' ;
+no warnings 'uninitialized' ;
my $y *= 2 ; #b
EXPECT
Use of uninitialized value at - line 4.
sub STORE { return 1 }
package main ;
tie $A, 'fred' ;
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
$B = 0 ;
$B |= $A ;
-no warning 'uninitialized' ;
+no warnings 'uninitialized' ;
$B = 0 ;
$B |= $A ;
EXPECT
Use of uninitialized value at - line 10.
########
# sv.c
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
my $Y = 1 ;
my $x = 1 | $a[$Y] ;
-no warning 'uninitialized' ;
+no warnings 'uninitialized' ;
my $Y = 1 ;
$x = 1 | $b[$Y] ;
EXPECT
Use of uninitialized value at - line 4.
########
# sv.c
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
my $x *= 1 ; # d
-no warning 'uninitialized' ;
+no warnings 'uninitialized' ;
my $y *= 1 ; # d
EXPECT
Use of uninitialized value at - line 3.
########
# sv.c
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
$x = 1 + $a[0] ; # e
-no warning 'uninitialized' ;
+no warnings 'uninitialized' ;
$x = 1 + $b[0] ; # e
EXPECT
Use of uninitialized value at - line 3.
sub STORE { return 1 }
package main ;
tie $A, 'fred' ;
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
$A *= 2 ;
-no warning 'uninitialized' ;
+no warnings 'uninitialized' ;
$A *= 2 ;
EXPECT
Use of uninitialized value at - line 9.
########
# sv.c
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
$x = $y + 1 ; # f
-no warning 'uninitialized' ;
+no warnings 'uninitialized' ;
$x = $z + 1 ; # f
EXPECT
Use of uninitialized value at - line 3.
########
# sv.c
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
$x = chop undef ; # g
-no warning 'uninitialized' ;
+no warnings 'uninitialized' ;
$x = chop undef ; # g
EXPECT
Modification of a read-only value attempted at - line 3.
########
# sv.c
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
$x = chop $y ; # h
-no warning 'uninitialized' ;
+no warnings 'uninitialized' ;
$x = chop $z ; # h
EXPECT
Use of uninitialized value at - line 3.
sub STORE { return 1 }
package main ;
tie $A, 'fred' ;
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
$B = "" ;
$B .= $A ;
-no warning 'uninitialized' ;
+no warnings 'uninitialized' ;
$C = "" ;
$C .= $A ;
EXPECT
Use of uninitialized value at - line 10.
########
# sv.c
-use warning 'numeric' ;
+use warnings 'numeric' ;
sub TIESCALAR{bless[]} ;
sub FETCH {"def"} ;
tie $a,"main" ;
my $b = 1 + $a;
-no warning 'numeric' ;
+no warnings 'numeric' ;
my $c = 1 + $a;
EXPECT
Argument "def" isn't numeric in add at - line 6.
########
# sv.c
-use warning 'numeric' ;
+use warnings 'numeric' ;
my $x = 1 + "def" ;
-no warning 'numeric' ;
+no warnings 'numeric' ;
my $z = 1 + "def" ;
EXPECT
Argument "def" isn't numeric in add at - line 3.
########
# sv.c
-use warning 'numeric' ;
+use warnings 'numeric' ;
my $a = "def" ;
my $x = 1 + $a ;
-no warning 'numeric' ;
+no warnings 'numeric' ;
my $y = 1 + $a ;
EXPECT
Argument "def" isn't numeric in add at - line 4.
########
# sv.c
-use warning 'numeric' ; use integer ;
+use warnings 'numeric' ; use integer ;
my $a = "def" ;
my $x = 1 + $a ;
-no warning 'numeric' ;
+no warnings 'numeric' ;
my $z = 1 + $a ;
EXPECT
Argument "def" isn't numeric in i_add at - line 4.
########
# sv.c
-use warning 'numeric' ;
+use warnings 'numeric' ;
my $x = 1 & "def" ;
-no warning 'numeric' ;
+no warnings 'numeric' ;
my $z = 1 & "def" ;
EXPECT
Argument "def" isn't numeric in bit_and at - line 3.
########
# sv.c
-use warning 'redefine' ;
+use warnings 'redefine' ;
sub fred {}
sub joe {}
*fred = \&joe ;
-no warning 'redefine' ;
+no warnings 'redefine' ;
sub jim {}
*jim = \&joe ;
EXPECT
Subroutine fred redefined at - line 5.
########
# sv.c
-use warning 'printf' ;
+use warnings 'printf' ;
open F, ">".($^O eq 'VMS'? 'NL:' : '/dev/null') ;
printf F "%z\n" ;
my $a = sprintf "%z" ;
$a = sprintf "%" ;
printf F "%\x02" ;
$a = sprintf "%\x02" ;
-no warning 'printf' ;
+no warnings 'printf' ;
printf F "%z\n" ;
$a = sprintf "%z" ;
printf F "%" ;
Invalid conversion in printf: "%\002" at - line 8.
########
# sv.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
*a = undef ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
*b = undef ;
EXPECT
Undefined value assigned to typeglob at - line 3.
use utf8 ;
$^W =0 ;
{
- use warning 'utf8' ;
+ use warnings 'utf8' ;
my $a = rindex "a\xff bc ", "bc" ;
- no warning 'utf8' ;
+ no warnings 'utf8' ;
$a = rindex "a\xff bc ", "bc" ;
}
my $a = rindex "a\xff bc ", "bc" ;
open(FH, "<abc") ;
$a = <FH> ;
close FH ;
-use warning 'taint' ;
+use warnings 'taint' ;
chdir $a ;
print "xxx\n" ;
-no warning 'taint' ;
+no warnings 'taint' ;
chdir $a ;
print "yyy\n" ;
EXPECT
(called 3 times via depcom)
\1 better written as $1
- use warning 'syntax' ;
+ use warnings 'syntax' ;
s/(abc)/\1/;
warn(warn_nosemi)
__END__
# toke.c
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
1 if $a EQ $b ;
1 if $a NE $b ;
1 if $a GT $b ;
1 if $a LT $b ;
1 if $a GE $b ;
1 if $a LE $b ;
-no warning 'deprecated' ;
+no warnings 'deprecated' ;
1 if $a EQ $b ;
1 if $a NE $b ;
1 if $a GT $b ;
Use of LE is deprecated at - line 8.
########
# toke.c
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
format STDOUT =
@<<< @||| @>>> @>>>
$a $b "abc" 'def'
.
-no warning 'deprecated' ;
+no warnings 'deprecated' ;
format STDOUT =
@<<< @||| @>>> @>>>
$a $b "abc" 'def'
Use of comma-less variable list is deprecated at - line 5.
########
# toke.c
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
$a = <<;
-no warning 'deprecated' ;
+no warnings 'deprecated' ;
$a = <<;
EXPECT
Use of bare << to mean <<"" is deprecated at - line 3.
########
# toke.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
s/(abc)/\1/;
-no warning 'syntax' ;
+no warnings 'syntax' ;
s/(abc)/\1/;
EXPECT
\1 better written as $1 at - line 3.
########
# toke.c
-use warning 'semicolon' ;
+use warnings 'semicolon' ;
$a = 1
&time ;
-no warning 'semicolon' ;
+no warnings 'semicolon' ;
$a = 1
&time ;
EXPECT
# Scalars leaked: due to syntax errors
$ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3;
}
-use warning 'syntax' ;
+use warnings 'syntax' ;
my $a =+ 2 ;
$a =- 2 ;
$a =* 2 ;
# Scalars leaked: due to syntax errors
$ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3;
}
-no warning 'syntax' ;
+no warnings 'syntax' ;
my $a =+ 2 ;
$a =- 2 ;
$a =* 2 ;
Unterminated <> operator at - line 15.
########
# toke.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
my $a = $a[1,2] ;
-no warning 'syntax' ;
+no warnings 'syntax' ;
my $a = $a[1,2] ;
EXPECT
Multidimensional syntax $a[1,2] not supported at - line 3.
########
# toke.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
sub fred {} ; $SIG{TERM} = fred;
-no warning 'syntax' ;
+no warnings 'syntax' ;
$SIG{TERM} = fred;
EXPECT
You need to quote "fred" at - line 3.
########
# toke.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
@a[3] = 2;
@a{3} = 2;
-no warning 'syntax' ;
+no warnings 'syntax' ;
@a[3] = 2;
@a{3} = 2;
EXPECT
Scalar value @a{3} better written as $a{3} at - line 4.
########
# toke.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
$_ = "ab" ;
s/(ab)/\1/e;
-no warning 'syntax' ;
+no warnings 'syntax' ;
$_ = "ab" ;
s/(ab)/\1/e;
EXPECT
Can't use \1 to mean $1 in expression at - line 4.
########
# toke.c
-use warning 'reserved' ;
+use warnings 'reserved' ;
$a = abc;
-no warning 'reserved' ;
+no warnings 'reserved' ;
$a = abc;
EXPECT
Unquoted string "abc" may clash with future reserved word at - line 3.
########
# toke.c
-use warning 'octal' ;
+use warnings 'octal' ;
chmod 3;
-no warning 'octal' ;
+no warnings 'octal' ;
chmod 3;
EXPECT
-chmod: mode argument is missing initial 0 at - line 3, at end of line
+chmod: mode argument is missing initial 0 at - line 3.
########
# toke.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
@a = qw(a, b, c) ;
-no warning 'syntax' ;
+no warnings 'syntax' ;
@a = qw(a, b, c) ;
EXPECT
Possible attempt to separate words with commas at - line 3.
########
# toke.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
@a = qw(a b #) ;
-no warning 'syntax' ;
+no warnings 'syntax' ;
@a = qw(a b #) ;
EXPECT
Possible attempt to put comments in qw() list at - line 3.
########
# toke.c
-use warning 'octal' ;
+use warnings 'octal' ;
umask 3;
-no warning 'octal' ;
+no warnings 'octal' ;
umask 3;
EXPECT
-umask: argument is missing initial 0 at - line 3, at end of line
+umask: argument is missing initial 0 at - line 3.
########
# toke.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
print ("")
EXPECT
print (...) interpreted as function at - line 3.
########
# toke.c
-no warning 'syntax' ;
+no warnings 'syntax' ;
print ("")
EXPECT
########
# toke.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
printf ("")
EXPECT
printf (...) interpreted as function at - line 3.
########
# toke.c
-no warning 'syntax' ;
+no warnings 'syntax' ;
printf ("")
EXPECT
########
# toke.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
sort ("")
EXPECT
sort (...) interpreted as function at - line 3.
########
# toke.c
-no warning 'syntax' ;
+no warnings 'syntax' ;
sort ("")
EXPECT
########
# toke.c
-use warning 'ambiguous' ;
+use warnings 'ambiguous' ;
$a = ${time[2]};
-no warning 'ambiguous' ;
+no warnings 'ambiguous' ;
$a = ${time[2]};
EXPECT
Ambiguous use of ${time[...]} resolved to $time[...] at - line 3.
########
# toke.c
-use warning 'ambiguous' ;
+use warnings 'ambiguous' ;
$a = ${time{2}};
EXPECT
Ambiguous use of ${time{...}} resolved to $time{...} at - line 3.
########
# toke.c
-no warning 'ambiguous' ;
+no warnings 'ambiguous' ;
$a = ${time{2}};
EXPECT
########
# toke.c
-use warning 'ambiguous' ;
+use warnings 'ambiguous' ;
$a = ${time} ;
-no warning 'ambiguous' ;
+no warnings 'ambiguous' ;
$a = ${time} ;
EXPECT
Ambiguous use of ${time} resolved to $time at - line 3.
########
# toke.c
-use warning 'ambiguous' ;
+use warnings 'ambiguous' ;
sub fred {}
$a = ${fred} ;
-no warning 'ambiguous' ;
+no warnings 'ambiguous' ;
$a = ${fred} ;
EXPECT
Ambiguous use of ${fred} resolved to $fred at - line 4.
########
# toke.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
$a = 1_2;
$a = 1_2345_6;
-no warning 'syntax' ;
+no warnings 'syntax' ;
$a = 1_2;
$a = 1_2345_6;
EXPECT
Misplaced _ in number at - line 4.
########
# toke.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
#line 25 "bar"
$a = FRED:: ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
#line 25 "bar"
$a = FRED:: ;
EXPECT
Bareword "FRED::" refers to nonexistent package at bar line 25.
########
# toke.c
-use warning 'ambiguous' ;
+use warnings 'ambiguous' ;
sub time {}
my $a = time() ;
-no warning 'ambiguous' ;
+no warnings 'ambiguous' ;
my $b = time() ;
EXPECT
Ambiguous call resolved as CORE::time(), qualify as such or use & at - line 4.
########
# toke.c
-use warning 'utf8' ;
+use warnings 'utf8' ;
eval <<'EOE';
{
#line 30 "foo"
Use of \x{} without utf8 declaration at foo line 30.
########
# toke.c
-no warning 'utf8' ;
+no warnings 'utf8' ;
eval <<'EOE';
{
#line 30 "foo"
########
# toke.c
-use warning 'utf8' ;
+use warnings 'utf8' ;
use utf8 ;
$_ = " \xffe " ;
-no warning 'utf8' ;
+no warnings 'utf8' ;
$_ = " \xffe " ;
EXPECT
\xff will produce malformed UTF-8 character; use \x{ff} for that at - line 4.
$^W = 0 ;
my $a = rand + 4 ;
{
- no warning 'ambiguous' ;
+ no warnings 'ambiguous' ;
$a = rand + 4 ;
- use warning 'ambiguous' ;
+ use warnings 'ambiguous' ;
$a = rand + 4 ;
}
$a = rand + 4 ;
sub fred {} ;
-fred ;
{
- no warning 'ambiguous' ;
+ no warnings 'ambiguous' ;
-fred ;
- use warning 'ambiguous' ;
+ use warnings 'ambiguous' ;
-fred ;
}
-fred ;
$^W = 0 ;
open FOO || time;
{
- no warning 'ambiguous' ;
+ no warnings 'ambiguous' ;
open FOO || time;
- use warning 'ambiguous' ;
+ use warnings 'ambiguous' ;
open FOO || time;
}
open FOO || time;
$^W = 0 ;
*foo *foo ;
{
- no warning 'ambiguous' ;
+ no warnings 'ambiguous' ;
*foo *foo ;
- use warning 'ambiguous' ;
+ use warnings 'ambiguous' ;
*foo *foo ;
}
*foo *foo ;
__END__
# universal.c
-use warning 'misc' ;
+use warnings 'misc' ;
EXPECT
use utf8 ;
my $a = ord "\x80" ;
{
- use warning 'utf8' ;
+ use warnings 'utf8' ;
my $a = ord "\x80" ;
- no warning 'utf8' ;
+ no warnings 'utf8' ;
my $a = ord "\x80" ;
}
EXPECT
use utf8 ;
my $a = ord "\xf080" ;
{
- use warning 'utf8' ;
+ use warnings 'utf8' ;
my $a = ord "\xf080" ;
- no warning 'utf8' ;
+ no warnings 'utf8' ;
my $a = ord "\xf080" ;
}
EXPECT
__END__
# util.c
-use warning 'digit' ;
+use warnings 'digit' ;
my $a = oct "029" ;
-no warning 'digit' ;
+no warnings 'digit' ;
my $a = oct "029" ;
EXPECT
Illegal octal digit '9' ignored at - line 3.
########
# util.c
-use warning 'digit' ;
+use warnings 'digit' ;
*a = hex "0xv9" ;
-no warning 'digit' ;
+no warnings 'digit' ;
*a = hex "0xv9" ;
EXPECT
Illegal hexadecimal digit 'v' ignored at - line 3.
########
# util.c
-use warning 'digit' ;
+use warnings 'digit' ;
*a = oct "0b9" ;
-no warning 'digit' ;
+no warnings 'digit' ;
*a = oct "0b9" ;
EXPECT
Illegal binary digit '9' ignored at - line 3.
if (ckWARN(WARN_OCTAL)) {
for (d = s; d < PL_bufend && (isSPACE(*d) || *d == '('); d++) ;
if (*d != '0' && isDIGIT(*d))
- yywarn("chmod: mode argument is missing initial 0");
+ Perl_warner(aTHX_ WARN_OCTAL,
+ "chmod: mode argument is missing initial 0");
}
LOP(OP_CHMOD,XTERM);
case KEY_umask:
if (ckWARN(WARN_OCTAL)) {
for (d = s; d < PL_bufend && (isSPACE(*d) || *d == '('); d++) ;
- if (*d != '0' && isDIGIT(*d))
- yywarn("umask: argument is missing initial 0");
+ if (*d != '0' && isDIGIT(*d))
+ Perl_warner(aTHX_ WARN_OCTAL,
+ "umask: argument is missing initial 0");
}
UNI(OP_UMASK);
/* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
- This file is built by warning.pl
+ This file is built by warnings.pl
Any changes made here will be lost!
*/
#define G_WARN_ALL_MASK (G_WARN_ALL_ON|G_WARN_ALL_OFF)
#define WARN_STD Nullsv
-#define WARN_ALL (&PL_sv_yes) /* use warning 'all' */
-#define WARN_NONE (&PL_sv_no) /* no warning 'all' */
+#define WARN_ALL (&PL_sv_yes) /* use warnings 'all' */
+#define WARN_NONE (&PL_sv_no) /* no warnings 'all' */
#define specialWARN(x) ((x) == WARN_STD || (x) == WARN_ALL || \
(x) == WARN_NONE)
#define WARN_ALLstring "\125\125\125\125\125\125\125\125\125"
#define WARN_NONEstring "\0\0\0\0\0\0\0\0\0"
-/* end of file warning.h */
+/* end of file warnings.h */
###########################################################################
-#unlink "warning.h";
-#unlink "lib/warning.pm";
-open(WARN, ">warning.h") || die "Can't create warning.h: $!\n";
-open(PM, ">lib/warning.pm") || die "Can't create lib/warning.pm: $!\n";
+#unlink "warnings.h";
+#unlink "lib/warnings.pm";
+open(WARN, ">warnings.h") || die "Can't create warnings.h: $!\n";
+open(PM, ">lib/warnings.pm") || die "Can't create lib/warnings.pm: $!\n";
print WARN <<'EOM' ;
/* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
- This file is built by warning.pl
+ This file is built by warnings.pl
Any changes made here will be lost!
*/
#define G_WARN_ALL_MASK (G_WARN_ALL_ON|G_WARN_ALL_OFF)
#define WARN_STD Nullsv
-#define WARN_ALL (&PL_sv_yes) /* use warning 'all' */
-#define WARN_NONE (&PL_sv_no) /* no warning 'all' */
+#define WARN_ALL (&PL_sv_yes) /* use warnings 'all' */
+#define WARN_NONE (&PL_sv_no) /* no warnings 'all' */
#define specialWARN(x) ((x) == WARN_STD || (x) == WARN_ALL || \
(x) == WARN_NONE)
print WARN <<'EOM';
-/* end of file warning.h */
+/* end of file warnings.h */
EOM
__END__
-# This file was created by warning.pl
+# This file was created by warnings.pl
# Any changes made here will be lost.
#
-package warning;
+package warnings;
=head1 NAME
-warning - Perl pragma to control optional warnings
+warnings - Perl pragma to control optional warnings
=head1 SYNOPSIS
- use warning;
- no warning;
+ use warnings;
+ no warnings;
- use warning "all";
- no warning "all";
+ use warnings "all";
+ no warnings "all";
=head1 DESCRIPTION
sub import {
shift;
- $^B |= bits(@_ ? @_ : 'all') ;
+ ${^Warnings} |= bits(@_ ? @_ : 'all') ;
}
sub unimport {
shift;
- $^B &= ~ bits(@_ ? @_ : 'all') ;
-}
-
-
-sub make_fatal
-{
- my $self = shift ;
- my $bitmask = $self->bits(@_) ;
- $SIG{__WARN__} =
- sub
- {
- die @_ if $^B & $bitmask ;
- warn @_
- } ;
-}
-
-sub bitmask
-{
- return $^B ;
+ ${^Warnings} &= ~ bits(@_ ? @_ : 'all') ;
}
sub enabled
my $string = shift ;
return 1
- if $bits{$string} && $^B & $bits{$string} ;
+ if $bits{$string} && ${^Warnings} & $bits{$string} ;
return 0 ;
}