summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Cornett <ben@lantern.is>2021-07-11 15:22:22 +0000
committerLeon Timmermans <fawaka@gmail.com>2021-08-15 13:40:54 +0200
commit1c3cfd8769dc1180ad2566f695094932197a2090 (patch)
tree2ffa9abf49b249e25bbcbf41c0f9269921d98f15
parent7656d14da076307d67e322c07d470d4ce8f57474 (diff)
downloadperl-1c3cfd8769dc1180ad2566f695094932197a2090.tar.gz
Document v5.35 warnings-on-by-default
-rw-r--r--lib/warnings.pm8
-rw-r--r--pod/perl.pod9
-rw-r--r--pod/perlfunc.pod19
-rw-r--r--pod/perlintro.pod8
-rw-r--r--regen/warnings.pl8
5 files changed, 37 insertions, 15 deletions
diff --git a/lib/warnings.pm b/lib/warnings.pm
index 1bd2dc2825..4b634de4d4 100644
--- a/lib/warnings.pm
+++ b/lib/warnings.pm
@@ -5,7 +5,7 @@
package warnings;
-our $VERSION = "1.52";
+our $VERSION = "1.53";
# Verify that we're called correctly so that warnings will work.
# Can't use Carp, since Carp uses us!
@@ -580,6 +580,9 @@ warnings - Perl pragma to control optional warnings
use warnings;
no warnings;
+ # Standard warnings are enabled by use v5.35 or above
+ use v5.35;
+
use warnings "all";
no warnings "uninitialized";
@@ -645,6 +648,9 @@ block has them disabled. In this case that means the assignment to the
scalar C<$z> will trip the C<"Scalar value @x[0] better written as $x[0]">
warning, but the assignment to the scalar C<$y> will not.
+All warnings are enabled automatically within the scope of
+a C<L<use v5.35|perlfunc/use VERSION>> (or higher) declaration.
+
=head2 Default Warnings and Optional Warnings
Before the introduction of lexical warnings, Perl had two classes of
diff --git a/pod/perl.pod b/pod/perl.pod
index 18f8cc0baf..d9ac3e1029 100644
--- a/pod/perl.pod
+++ b/pod/perl.pod
@@ -393,10 +393,13 @@ see L<perlvar> for more information.
Using the C<use strict> pragma ensures that all variables are properly
declared and prevents other misuses of legacy Perl features.
+These are enabled by default within the scope of
+C<L<use v5.12|perlfunc/use VERSION>> (or higher).
-The C<use warnings> pragma produces some lovely diagnostics. One can
-also use the B<-w> flag, but its use is normally discouraged, because
-it gets applied to all executed Perl code, including that not under
+The C<use warnings> pragma produces some lovely diagnostics.
+It is enabled by default when you say C<use v5.35> (or higher).
+One can also use the B<-w> flag, but its use is normally discouraged,
+because it gets applied to all executed Perl code, including that not under
your control.
See L<perldiag> for explanations of all Perl's diagnostics. The C<use
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 2fe7404fc9..8227969f4f 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -9638,18 +9638,19 @@ L<C<use>|/use Module VERSION LIST>ing library modules that won't work
with older versions of Perl.
(We try not to do this more than we have to.)
-C<use VERSION> also lexically enables all features available in the requested
+C<use VERSION> lexically enables all features available in the requested
version as defined by the L<feature> pragma, disabling any features
not in the requested version's feature bundle. See L<feature>.
-Similarly, if the specified Perl version is greater than or equal to
+If the specified Perl version is greater than or equal to
5.12.0, strictures are enabled lexically as
-with L<C<use strict>|strict>. Any explicit use of
-C<use strict> or C<no strict> overrides C<use VERSION>, even if it comes
-before it. Later use of C<use VERSION>
-will override all behavior of a previous
-C<use VERSION>, possibly removing the C<strict> and C<feature> added by
-C<use VERSION>. C<use VERSION> does not
-load the F<feature.pm> or F<strict.pm>
+with L<C<use strict>|strict>.
+Similarly, L<warnings> are enabled if C<VERSION> is 5.35.0 or higher.
+Any explicit use of C<use strict> or C<no strict> overrides C<use VERSION>,
+even if it comes before it.
+Later use of C<use VERSION> will override all behavior of a previous
+C<use VERSION>, possibly removing the C<strict>, C<warnings>, and C<feature>
+added by C<use VERSION>. C<use VERSION> does not
+load the F<feature.pm>, F<strict.pm>, or F<warnings.pm>
files.
The C<BEGIN> forces the L<C<require>|/require VERSION> and
diff --git a/pod/perlintro.pod b/pod/perlintro.pod
index c4a6d758f6..a56c4989e6 100644
--- a/pod/perlintro.pod
+++ b/pod/perlintro.pod
@@ -93,9 +93,15 @@ problems in your code. They check different things so you need both. A
potential problem caught by C<use strict;> will cause your code to stop
immediately when it is encountered, while C<use warnings;> will merely
give a warning (like the command-line switch B<-w>) and let your code run.
-To read more about them check their respective manual pages at L<strict>
+To read more about them, check their respective manual pages at L<strict>
and L<warnings>.
+A C<L<use v5.35|perlfunc/use VERSION>> (or higher) declaration will
+enable both C<strict> and C<warnings>:
+
+ #!/usr/bin/perl
+ use v5.35;
+
=head2 Basic syntax overview
A Perl script or program consists of one or more statements. These
diff --git a/regen/warnings.pl b/regen/warnings.pl
index 0987b8be32..056851f592 100644
--- a/regen/warnings.pl
+++ b/regen/warnings.pl
@@ -16,7 +16,7 @@
#
# This script is normally invoked from regen.pl.
-$VERSION = '1.52';
+$VERSION = '1.53';
BEGIN {
require './regen/regen_lib.pl';
@@ -882,6 +882,9 @@ warnings - Perl pragma to control optional warnings
use warnings;
no warnings;
+ # Standard warnings are enabled by use v5.35 or above
+ use v5.35;
+
use warnings "all";
no warnings "uninitialized";
@@ -947,6 +950,9 @@ block has them disabled. In this case that means the assignment to the
scalar C<$z> will trip the C<"Scalar value @x[0] better written as $x[0]">
warning, but the assignment to the scalar C<$y> will not.
+All warnings are enabled automatically within the scope of
+a C<L<use v5.35|perlfunc/use VERSION>> (or higher) declaration.
+
=head2 Default Warnings and Optional Warnings
Before the introduction of lexical warnings, Perl had two classes of