develooper Front page | perl.perl5.porters | Postings from December 2013

[perl #120827] [PATCH] Fix a tab-completion bug in perl -d with Term::ReadLine::Gnu

shlomif @ shlomifish . org
December 19, 2013 11:31
[perl #120827] [PATCH] Fix a tab-completion bug in perl -d with Term::ReadLine::Gnu
Message ID:
# New Ticket Created by 
# Please include the string:  [perl #120827]
# in the subject line of all future correspondence about this issue. 
# <URL: >

Hi all,

I noticed that when I type "$F" and then tab complete inside perl -d with
Term::ReadLine::Gnu (and possibly Term::ReadLine::Perl as well), then it causes
the debugger to crash, like that:

shlomif@telaviv1:~/progs/riddles/project-euler/hg/project-euler/160$ perl -d eul

Loading DB routines from version 1.39_10
Editor support available.

Enter h or 'h h' for help, or 'man perldebug' for more help.

main::( my $N = abs(int($ENV{N} || 1_000_000_000_000));
  DB<147> b 89
  DB<148> c
There are 249999999997 powers of 5.
There are 999999999987 components of 2.
There are 749999999990 components of 2 excluding those for the digits.
They contribute 20224 to the modulo
main::(            $FINAL_100k_MODULO = $mod;
  DB<148> x $F
0  undef
  DB<149> x $FCan't use string ("::") as a HASH ref while "strict refs" in use
at /usr/lib/perl5/5.18.1/ line 9513.
at /usr/lib/perl5/5.18.1/ line 9513. DB::db_complete('$F', 'x $F', 2)
at /usr/lib/perl5/vendor_perl/5.18.1/x86_64-linux-thread-multi/Term/ReadLine/Gnu/
line 574 Term::ReadLine::Gnu::XS::_trp_completion_function('$F', 0) called
at /usr/lib/perl5/vendor_perl/5.18.1/x86_64-linux-thread-multi/Term/ReadLine/
line 719
'\x{1}\x{1b}[4m\x{2}  DB<149> \x{1}\x{1b}[24m\x{2}') called
at /usr/lib/perl5/vendor_perl/5.18.1/x86_64-linux-thread-multi/Term/ReadLine/
line 331 Term::ReadLine::Gnu::readline('Term::ReadLine=HASH(0x1a58508)', '
DB<149> ') called at /usr/lib/perl5/5.18.1/ line 7281 DB::readline('
DB<149> ') called at /usr/lib/perl5/5.18.1/ line 1831
DB::_DB__read_next_cmd(undef) called at /usr/lib/perl5/5.18.1/ line
2741 DB::DB called at line 89 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. DB<149> [1]

The attached patch fixes it by adding "do { no strict 'refs'; ...}". I didn't
add a test, but all existing debugger and non-debugger tests pass. It's
possible this bug was already reported in perlbug, but I'm too lazy to find it


	Shlomi Fish

Shlomi Fish
Chuck Norris/etc. Facts -

Judaism: God knows you will do shit, does nothing to prevent it, but makes you
take the blame for it anyways.

Please reply to list if it's a mailing list post - . Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About