This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Implement fatalization of dump()
authorJames E Keenan <jkeenan@cpan.org>
Sat, 13 Oct 2018 02:29:46 +0000 (22:29 -0400)
committerJames E Keenan <jkeenan@cpan.org>
Wed, 17 Oct 2018 11:59:14 +0000 (07:59 -0400)
Must now be written fully qualified: CORE::dump().

Adapt tests that previously warned, plus adapt one test that incidentally used dump().

For: RT # 133584

pod/perldiag.pod
pod/perlfunc.pod
pod/perlpodspec.pod
pod/perlrun.pod
t/lib/croak/pp_ctl
t/lib/croak/toke
t/lib/warnings/toke
t/op/dump.t
toke.c

index afac879..82d3e4e 100644 (file)
@@ -2128,13 +2128,11 @@ something that isn't defined yet, you don't actually have to define the
 subroutine or package before the current location.  You can use an empty
 "sub foo;" or "package FOO;" to enter a "forward" declaration.
 
-=item dump() better written as CORE::dump(). dump() will no longer be available in Perl 5.30
+=item dump() must be written as CORE::dump() as of Perl 5.30
 
-(D deprecated, misc) You used the obsolescent C<dump()> built-in function,
-without fully qualifying it as C<CORE::dump()>. Maybe it's a typo.
-
-Use of a unqualified C<dump()> was deprecated in Perl 5.8.0, and this
-will not be available in Perl 5.30.
+(F) You used the obsolete C<dump()> built-in function.  That was deprecated in
+Perl 5.8.0.  As of Perl 5.30 it must be written in fully qualified format:
+C<CORE::dump()>.
 
 See L<perlfunc/dump>.
 
index 316daff..9394e22 100644 (file)
@@ -1921,9 +1921,8 @@ be open any more when the program is reincarnated, with possible
 resulting confusion by Perl.
 
 This function is now largely obsolete, mostly because it's very hard to
-convert a core file into an executable.  That's why you should now invoke
-it as C<CORE::dump()> if you don't want to be warned against a possible
-typo.
+convert a core file into an executable.  As of Perl 5.30, it must be invoked
+as C<CORE::dump()>.
 
 Unlike most named operators, this has the same precedence as assignment.
 It is also exempt from the looks-like-a-function rule, so
index 4fea607..3ae2cc5 100644 (file)
@@ -396,7 +396,7 @@ matching ">".  Examples:
 
     That's what I<you> think!
 
-    What's C<dump()> for?
+    What's C<CORE::dump()> for?
 
     X<C<chmod> and C<unlink()> Under Different Operating Systems>
 
index 93a2746..9c52a0d 100644 (file)
@@ -852,8 +852,8 @@ into an executable file by using the I<undump> program (not supplied).
 This speeds startup at the expense of some disk space (which you
 can minimize by stripping the executable).  (Still, a "hello world"
 executable comes out to about 200K on my machine.)  If you want to
-execute a portion of your program before dumping, use the dump()
-operator instead.  Note: availability of I<undump> is platform
+execute a portion of your program before dumping, use the C<CORE::dump()>
+function instead.  Note: availability of I<undump> is platform
 specific and may not be available for a specific port of Perl.
 
 =item B<-U>
index f705b65..b1e754c 100644 (file)
@@ -36,7 +36,7 @@ Can't "goto" into a binary or list expression at - line 5.
 # NAME dump with computed label
 no warnings 'deprecated';
 my $label = "foo";
-dump $label;
+CORE::dump $label;
 EXPECT
 Can't find label foo at - line 3.
 ########
index 1d45a3f..4a01c7a 100644 (file)
@@ -480,3 +480,10 @@ Bareword found where operator expected at - line 2, near "2p0"
        (Missing operator before p0?)
 syntax error at - line 2, near "2p0"
 Execution of - aborted due to compilation errors.
+########
+# NAME dump() must be written as CORE::dump() as of Perl 5.30
+BEGIN { $^C = 1; }
+dump;
+CORE::dump;
+EXPECT
+dump() must be written as CORE::dump() as of Perl 5.30 at - line 2.
index 45cdba5..1c85d7b 100644 (file)
@@ -109,8 +109,6 @@ toke.c      AOK
         $a =  0037777777777 ;
         $a =  0047777777777 ;
 
-    dump() better written as CORE::dump()
-
     Use of /c modifier is meaningless without /g     
 
     Use of /c modifier is meaningless in s///
@@ -1182,40 +1180,6 @@ Integer overflow in hexadecimal number at - line 8.
 Integer overflow in octal number at - line 11.
 ########
 # toke.c
-BEGIN { $^C = 1; }
-dump;
-CORE::dump;
-EXPECT
-dump() better written as CORE::dump(). dump() will no longer be available in Perl 5.30 at - line 3.
-- syntax OK
-########
-# toke.c
-BEGIN { $^C = 1; }
-no warnings 'deprecated';
-dump;
-CORE::dump;
-EXPECT
-- syntax OK
-########
-# toke.c
-BEGIN { $^C = 1; }
-no warnings 'deprecated';
-use warnings 'misc';
-dump;
-CORE::dump;
-EXPECT
-dump() better written as CORE::dump(). dump() will no longer be available in Perl 5.30 at - line 5.
-- syntax OK
-########
-# toke.c
-use warnings 'misc';
-use subs qw/dump/;
-sub dump { print "no warning for overridden dump\n"; }
-dump;
-EXPECT
-no warning for overridden dump
-########
-# toke.c
 use warnings 'ambiguous';
 "@mjd_previously_unused_array";        
 no warnings 'ambiguous';
index 2edba20..397c5b5 100644 (file)
@@ -45,14 +45,14 @@ plan(2);
 
 # Depending on how perl is built, there may be extraneous stuff on stderr
 # such as "Aborted", which isn't caught by the '2>&1' that
-# fresh_perl_like() does. So execute each dump() in a sub-process.
+# fresh_perl_like() does. So execute each CORE::dump() in a sub-process.
 #
 # In detail:
 # fresh_perl_like() ends up doing a `` which invokes a shell with 2 args:
 #
 #   "sh", "-c", "perl /tmp/foo 2>&1"
 #
-# When the perl process coredumps after calling dump(), the parent
+# When the perl process coredumps after calling CORE::dump(), the parent
 # sh sees that the exit of the child flags a coredump and so prints
 # something like the following to stderr:
 #
@@ -80,13 +80,12 @@ if ($pid) {
 else {
     # child
     print qq(A);
-    dump;
+    CORE::dump;
     print qq(B);
 }
 PROG
 
-fresh_perl_like(<<'PROG', qr/A(?!B\z)/, {}, "dump with label quits");
-BEGIN {$SIG {__WARN__} = sub {1;}}
+fresh_perl_like(<<'PROG', qr/A(?!B\z)/, {}, "CORE::dump with label quits"); BEGIN {$SIG {__WARN__} = sub {1;}}
 ++$|;
 my $pid = fork;
 die "fork: $!\n" unless defined $pid;
@@ -96,7 +95,7 @@ if ($pid) {
 }
 else {
     print qq(A);
-    dump foo;
+    CORE::dump foo;
     foo:
     print qq(B);
 }
diff --git a/toke.c b/toke.c
index 24e614f..0527bd8 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -7248,10 +7248,7 @@ Perl_yylex(pTHX)
            else {                      /* no override */
                tmp = -tmp;
                if (tmp == KEY_dump) {
-                   Perl_ck_warner_d(aTHX_ packWARN2(WARN_MISC,WARN_DEPRECATED),
-                                    "dump() better written as CORE::dump(). "
-                                     "dump() will no longer be available "
-                                     "in Perl 5.30");
+                   Perl_croak(aTHX_ "dump() must be written as CORE::dump() as of Perl 5.30");
                }
                gv = NULL;
                gvp = 0;