You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider this program, which I run with Perl 5's debugger:
#$ cat debuggable.pl use strict;
use warnings;
my@letters = ( qw| alpha beta gamma | );
my@numbers = (1..3);
print"Finished\n";
$ perl -d debuggable.pl
Loading DB routines from perl5db.pl version 1.57
Editor support available.
Enter h or 'h h' for help, or 'man perldebug' for more help.
main::(debuggable.pl:4): my @letters = ( qw| alpha beta gamma | );
DB<1> n
main::(debuggable.pl:6): my @numbers = (1..3);
DB<1>
main::(debuggable.pl:8): print "Finished\n";
DB<1> x \@letters
0 ARRAY(0x5556b9725e98)
0 'alpha'
1 'beta'
2 'gamma'
DB<2> x [ @numbers ]
0 ARRAY(0x5556b9d542d0)
0 1
1 2
2 3
DB<3> c
Finished
Debugged program terminated. Use q to quit or R to restart,
use o inhibit_exit to avoid stopping after program termination,
h q, h R or h o to get additional info.
Once we have a Perl (7) executable with strict-by-default, the use strict; statement becomes unnecessary and we can rewrite the file as:
$ cat debug7.pl
use warnings;
my @letters = ( qw| alpha beta gamma | );
my @numbers = (1..3);
print "Finished\n";
However, when we attempt to run it through the debugger, all hell breaks loose.
$ ./perl -Ilib -d ~/learn/perl/p5p/debug7.pl
Loading DB routines from perl5db.pl version 1.57
Editor support available.
Enter h or 'h h' for help, or 'man perldebug' for more help.
main::(/home/jkeenan/learn/perl/p5p/debug7.pl:3):
3: my @letters = ( qw| alpha beta gamma | );
DB<1> n
main::(/home/jkeenan/learn/perl/p5p/debug7.pl:5):
5: my @numbers = (1..3);
DB<1> x \@letters
Variable "$dumpReused" is not imported at lib/dumpvar.pl line 27.
at lib/dumpvar.pl line 27.
require dumpvar.pl called at lib/perl5db.pl line 6391
DB::dumpit(GLOB(0x55eba8300f78), ARRAY(0x55eba80ede08)) called at lib/perl5db.pl line 767
DB::eval called at lib/perl5db.pl line 3138
DB::DB called at /home/jkeenan/learn/perl/p5p/debug7.pl line 5
Variable "$dumpReused" is not imported at lib/dumpvar.pl line 27.
at lib/dumpvar.pl line 27.
require dumpvar.pl called at lib/perl5db.pl line 6391
DB::dumpit(GLOB(0x55eba8300f78), ARRAY(0x55eba80ede08)) called at lib/perl5db.pl line 767
DB::eval called at lib/perl5db.pl line 3138
DB::DB called at /home/jkeenan/learn/perl/p5p/debug7.pl line 5
Variable "$bareStringify" is not imported at lib/dumpvar.pl line 28.
at lib/dumpvar.pl line 28.
require dumpvar.pl called at lib/perl5db.pl line 6391
DB::dumpit(GLOB(0x55eba8300f78), ARRAY(0x55eba80ede08)) called at lib/perl5db.pl line 767
DB::eval called at lib/perl5db.pl line 3138
DB::DB called at /home/jkeenan/learn/perl/p5p/debug7.pl line 5
Variable "$bareStringify" is not imported at lib/dumpvar.pl line 28.
at lib/dumpvar.pl line 28.
require dumpvar.pl called at lib/perl5db.pl line 6391
DB::dumpit(GLOB(0x55eba8300f78), ARRAY(0x55eba80ede08)) called at lib/perl5db.pl line 767
DB::eval called at lib/perl5db.pl line 3138
DB::DB called at /home/jkeenan/learn/perl/p5p/debug7.pl line 5
Variable "$bareStringify" is not imported at lib/dumpvar.pl line 79.
at lib/dumpvar.pl line 79.
require dumpvar.pl called at lib/perl5db.pl line 6391
DB::dumpit(GLOB(0x55eba8300f78), ARRAY(0x55eba80ede08)) called at lib/perl5db.pl line 767
DB::eval called at lib/perl5db.pl line 3138
DB::DB called at /home/jkeenan/learn/perl/p5p/debug7.pl line 5
Variable "$unctrl" is not imported at lib/dumpvar.pl line 97.
at lib/dumpvar.pl line 97.
require dumpvar.pl called at lib/perl5db.pl line 6391
DB::dumpit(GLOB(0x55eba8300f78), ARRAY(0x55eba80ede08)) called at lib/perl5db.pl line 767
DB::eval called at lib/perl5db.pl line 3138
DB::DB called at /home/jkeenan/learn/perl/p5p/debug7.pl line 5
Variable "$compactDump" is not imported at lib/dumpvar.pl line 132.
at lib/dumpvar.pl line 132.
require dumpvar.pl called at lib/perl5db.pl line 6391
DB::dumpit(GLOB(0x55eba8300f78), ARRAY(0x55eba80ede08)) called at lib/perl5db.pl line 767
DB::eval called at lib/perl5db.pl line 3138
DB::DB called at /home/jkeenan/learn/perl/p5p/debug7.pl line 5
(Did you mean &compactDump instead?)
at lib/dumpvar.pl line 132.
require dumpvar.pl called at lib/perl5db.pl line 6391
DB::dumpit(GLOB(0x55eba8300f78), ARRAY(0x55eba80ede08)) called at lib/perl5db.pl line 767
DB::eval called at lib/perl5db.pl line 3138
DB::DB called at /home/jkeenan/learn/perl/p5p/debug7.pl line 5
Variable "$veryCompact" is not imported at lib/dumpvar.pl line 139.
at lib/dumpvar.pl line 139.
require dumpvar.pl called at lib/perl5db.pl line 6391
DB::dumpit(GLOB(0x55eba8300f78), ARRAY(0x55eba80ede08)) called at lib/perl5db.pl line 767
DB::eval called at lib/perl5db.pl line 3138
DB::DB called at /home/jkeenan/learn/perl/p5p/debug7.pl line 5
(Did you mean &veryCompact instead?)
at lib/dumpvar.pl line 139.
require dumpvar.pl called at lib/perl5db.pl line 6391
DB::dumpit(GLOB(0x55eba8300f78), ARRAY(0x55eba80ede08)) called at lib/perl5db.pl line 767
DB::eval called at lib/perl5db.pl line 3138
DB::DB called at /home/jkeenan/learn/perl/p5p/debug7.pl line 5
Global symbol "$winsize" requires explicit package name (did you forget to declare "my $winsize"?) at lib/dumpvar.pl line 15.
Global symbol "$winsize" requires explicit package name (did you forget to declare "my $winsize"?) at lib/dumpvar.pl line 15.
Global symbol "$tick" requires explicit package name (did you forget to declare "my $tick"?) at lib/dumpvar.pl line 24.
Global symbol "$tick" requires explicit package name (did you forget to declare "my $tick"?) at lib/dumpvar.pl line 24.
Global symbol "$unctrl" requires explicit package name (did you forget to declare "my $unctrl"?) at lib/dumpvar.pl line 25.
Global symbol "$unctrl" requires explicit package name (did you forget to declare "my $unctrl"?) at lib/dumpvar.pl line 25.
Global symbol "$subdump" requires explicit package name (did you forget to declare "my $subdump"?) at lib/dumpvar.pl line 26.
Global symbol "$dumpReused" requires explicit package name (did you forget to declare "my $dumpReused"?) at lib/dumpvar.pl line 27.
Global symbol "$dumpReused" requires explicit package name (did you forget to declare "my $dumpReused"?) at lib/dumpvar.pl line 27.
Global symbol "$bareStringify" requires explicit package name (did you forget to declare "my $bareStringify"?) at lib/dumpvar.pl line 28.
Global symbol "$bareStringify" requires explicit package name (did you forget to declare "my $bareStringify"?) at lib/dumpvar.pl line 28.
Bareword "ASCII" not allowed while "strict subs" in use at lib/dumpvar.pl line 31.
Global symbol "%address" requires explicit package name (did you forget to declare "my %address"?) at lib/dumpvar.pl line 34.
Global symbol "$v" requires explicit package name (did you forget to declare "my $v"?) at lib/dumpvar.pl line 46.
Global symbol "$noticks" requires explicit package name (did you forget to declare "my $noticks"?) at lib/dumpvar.pl line 71.
Global symbol "$v" requires explicit package name (did you forget to declare "my $v"?) at lib/dumpvar.pl line 73.
Global symbol "$tick" requires explicit package name (did you forget to declare "my $tick"?) at lib/dumpvar.pl line 74.
Global symbol "$bareStringify" requires explicit package name (did you forget to declare "my $bareStringify"?) at lib/dumpvar.pl line 79.
Global symbol "$unctrl" requires explicit package name (did you forget to declare "my $unctrl"?) at lib/dumpvar.pl line 91.
Global symbol "$unctrl" requires explicit package name (did you forget to declare "my $unctrl"?) at lib/dumpvar.pl line 97.
Global symbol "$noticks" requires explicit package name (did you forget to declare "my $noticks"?) at lib/dumpvar.pl line 104.
Global symbol "$short" requires explicit package name (did you forget to declare "my $short"?) at lib/dumpvar.pl line 130.
Global symbol "$short" requires explicit package name (did you forget to declare "my $short"?) at lib/dumpvar.pl line 132.
Global symbol "$short" requires explicit package name (did you forget to declare "my $short"?) at lib/dumpvar.pl line 132.
Global symbol "$compactDump" requires explicit package name (did you forget to declare "my $compactDump"?) at lib/dumpvar.pl line 132.
Global symbol "$veryCompact" requires explicit package name (did you forget to declare "my $veryCompact"?) at lib/dumpvar.pl line 139.
Global symbol "$v" requires explicit package name (did you forget to declare "my $v"?) at lib/dumpvar.pl line 141.
Execution of lib/dumpvar.pl aborted due to compilation errors.
at lib/dumpvar.pl line 141.
require dumpvar.pl called at lib/perl5db.pl line 6391
DB::dumpit(GLOB(0x55eba8300f78), ARRAY(0x55eba80ede08)) called at lib/perl5db.pl line 767
DB::eval called at lib/perl5db.pl line 3138
DB::DB called at /home/jkeenan/learn/perl/p5p/debug7.pl line 5
at lib/perl5db.pl line 6391.
DB::dumpit(GLOB(0x55eba8300f78), ARRAY(0x55eba80ede08)) called at lib/perl5db.pl line 767
DB::eval called at lib/perl5db.pl line 3138
DB::DB called at /home/jkeenan/learn/perl/p5p/debug7.pl line 5
Debugged program terminated. Use q to quit or R to restart,
use o inhibit_exit to avoid stopping after program termination,
h q, h R or h o to get additional info.
The x command in the Perl debugger is one of several bits of functionality that depends on lib/dumpvar.pl. This program, which dates from the mid-1990s, has global variables flying all over the place. I made an attempt at refactoring it yesterday and eventually realized that this would be as big a challenge as refactoring ExtUtils::ParseXS, which I took on in 2010 and was my entree into working with the Perl core distribution.
So, for the time being, I have relaxed strictures in lib/dumpvar.pl.
commit 8e9a3902af72c1177b05b7810b23e822d6396de8 (HEAD -> alpha-dev-02-strict,
upstream/alpha-dev-02-strict, origin/alpha-dev-02-strict)
Author: James E Keenan <[email protected]>
Date: Thu Aug 13 09:26:40 2020 -0400
lib/dumpvar.pl: needs to run 'no strict' for now
This progam is a classic example of mid-1990s Perl brilliance. It is
the backbone of, among other things, the 'x' command in the Perl
debugger. But it has global variables flying all over the place, so it
won't compile or run under 'use strict' in Perl 5, much less in a Perl
7-ish environment where strict is in every breath you take.
diff --git a/lib/dumpvar.pl b/lib/dumpvar.pl
index b2f3798c43..965177c3ea 100644
--- a/lib/dumpvar.pl
+++ b/lib/dumpvar.pl
@@ -1,5 +1,6 @@
require 5.014; # For more reliable $@ after eval
package dumpvar;
+no strict;
# Needed for PrettyPrinter only:
Ultimately, we need to refactor lib/dumpvar.pl so that it is strict-compliant in either Perl 5 or 7.
I think a better way to mark these files as need work is to add a use v5 to them.
I have to disagree with you, there, Nico. The meaning of no strict; is well-defined, unambiguous, something I've understood for twenty years. As our recent technical meetings have demonstrated, what use vNhas meant is not as well understood and what it will mean in the future is still subject to contention.
Consider this program, which I run with Perl 5's debugger:
Once we have a Perl (7) executable with strict-by-default, the
use strict;
statement becomes unnecessary and we can rewrite the file as:However, when we attempt to run it through the debugger, all hell breaks loose.
The
x
command in the Perl debugger is one of several bits of functionality that depends onlib/dumpvar.pl
. This program, which dates from the mid-1990s, has global variables flying all over the place. I made an attempt at refactoring it yesterday and eventually realized that this would be as big a challenge as refactoring ExtUtils::ParseXS, which I took on in 2010 and was my entree into working with the Perl core distribution.So, for the time being, I have relaxed strictures in
lib/dumpvar.pl
.Ultimately, we need to refactor
lib/dumpvar.pl
so that it is strict-compliant in either Perl 5 or 7.@atoomic
Thank you very much.
Jim Keenan
The text was updated successfully, but these errors were encountered: