develooper Front page | perl.perl5.porters | Postings from January 2012

perl5db -> You can't FIRSTKEY with the %~ hash

From:
kevin dawson
Date:
January 23, 2012 11:49
Subject:
perl5db -> You can't FIRSTKEY with the %~ hash
Message ID:
4F1DB99F.6000502@btclick.com
hi, all

I can get perl -d to do this,

You can't FIRSTKEY with the %~ hash at 
/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/dumpvar.pl line 382
     ...propagated at 
/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/perl5db.pl line 
2471.
  at /home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/perl5db.pl 
line 2471
     DB::DB called at sewi.pl line 23
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<2>

Q, is this due to my lack of knowledge or have I found a bug?

why dose the debugger action X (V) cause this.


perl5db.pl line 2471.
|||if| |($@) {|
|||die| |unless| |$@ =~ /dumpvar ||print| |failed/;|
|||}|

why can't perl5db generate an error, like action p after starting, like so:

   DB<3> p
Use of uninitialized value $_ in print at (eval
     
18)[/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/perl5db.pl:646] 
line 2 (#1)
     (W uninitialized) An undefined value was used as if it were already
     defined.  It was interpreted as a "" or a 0, but maybe it was a 
mistake.
     To suppress this warning assign a defined value to your variables.

     To help you figure out what was undefined, perl will try to tell you
     the name of the variable (if any) that was undefined.  In some cases
     it cannot do this, so it also tells you what operation you used the
     undefined value in.  Note, however, that perl optimizes your program
     anid the operation displayed in the warning may not necessarily appear
     literally in your program.  For example, "that $foo" is usually
     optimized into "that " . $foo, and the warning will refer to the
     concatenation (.) operator, even though there is no . in
     your program.

Use of uninitialized value $_ in print at (eval 
18)[/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/perl5db.pl:646] 
line 2.
  at (eval 
18)[/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/perl5db.pl:646] 
line 2
     eval '($@, $!, $^E, $,, $/, $\\, $^W) = @saved;package main; $^D = 
$^D | $DB::db_stop;
print {$DB::OUT} $_;

;' called at 
/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/perl5db.pl line 646
     DB::eval called at 
/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/perl5db.pl line 3504
     DB::DB called at sewi.pl line 7


So the question is do we have to 'die' could we not 'warn' instead?


#die unless $@ =~ /dumpvar print failed/;
&warn("dumpvar print failed");


regards
bowtie

full debug trace follows, if that helps.

kevin@vinny:~/src/Padre/Padre-Plugin-Debug/scripts$ perl -d sewi.pl

Loading DB routines from perl5db.pl version 1.36
Editor support available.

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

main::(sewi.pl:7):    $| = 1;
                                                                                                                                       DB<1> v
4:    use strict;
5:    use warnings;
6     # Turn on $OUTPUT_AUTOFLUSH
7==>    $| = 1;
8:    use diagnostics;
9:    use utf8;
10
11:    use Data::Printer { caller_info => 1 };
12:    use FindBin qw($Bin);
13:    use lib ("$Bin");
                                                                                                                                       DB<1> v
11:    use Data::Printer { caller_info => 1 };
12:    use FindBin qw($Bin);
13:    use lib ("$Bin");
14
15:    use ExSewi qw(wh eh);
16
17:    my $fred = 'bloggs one';
18
19     #bp 20, this is 19
20:    wh("foo");
                                                                                                                                       DB<1> b 20
                                                                                                                                       DB<2> c
main::(sewi.pl:20):    wh("foo");
                                                                                                                                       DB<2> s
ExSewi::wh(/usr/src/Padre/Padre-Plugin-Debug/scripts/ExSewi.pm:16):
16:        my $fred = 'bloggs two';
                                                                                                                                       DB<2> v
13
14     sub wh {
15
16==>        my $fred = 'bloggs two';
17
18         #bp 19-20 this is 18
19:        say 'running wh';
20:        say $_[0];
21
22:        $_ = "He's out bowling with Barney tonight.";
                                                                                                                                       DB<2> b 19
                                                                                                                                       DB<3> l
23:        s/Barney/Fred/; # Replace Barney with Fred
24:        s/\w+$/($`!)$&/;
25:        say $_;
26
27:        return;
28     }
29
30     sub eh {
31:        my $fred = $_[0];
32:        $_[0] = 'not fred';
                                                                                                                                       DB<3> L
sewi.pl:
  20:    wh("foo");
    break if (1)
/usr/src/Padre/Padre-Plugin-Debug/scripts/ExSewi.pm:
  19:        say 'running wh';
    break if (1)
                                                                                                                                       DB<3> X
@EXPORT_OK = (
    0  'wh'
    1  'eh'
)
@ISA = (
    0  'Exporter'
)
$VERSION = 0.01
                                                                                                                                       DB<3> s
ExSewi::wh(/usr/src/Padre/Padre-Plugin-Debug/scripts/ExSewi.pm:19):
19:        say 'running wh';
                                                                                                                                       DB<3> .
ExSewi::wh(/usr/src/Padre/Padre-Plugin-Debug/scripts/ExSewi.pm:19):
19:        say 'running wh';
                                                                                                                                       DB<3> v
16:        my $fred = 'bloggs two';
17
18         #bp 19-20 this is 18
19==>b        say 'running wh';
20:        say $_[0];
21
22:        $_ = "He's out bowling with Barney tonight.";
23:        s/Barney/Fred/; # Replace Barney with Fred
24:        s/\w+$/($`!)$&/;
25:        say $_;
                                                                                                                                       DB<3> s
running wh
ExSewi::wh(/usr/src/Padre/Padre-Plugin-Debug/scripts/ExSewi.pm:20):
20:        say $_[0];
                                                                                                                                       DB<3> s
foo
ExSewi::wh(/usr/src/Padre/Padre-Plugin-Debug/scripts/ExSewi.pm:22):
22:        $_ = "He's out bowling with Barney tonight.";
                                                                                                                                       DB<3> s
ExSewi::wh(/usr/src/Padre/Padre-Plugin-Debug/scripts/ExSewi.pm:23):
23:        s/Barney/Fred/; # Replace Barney with Fred
                                                                                                                                       DB<3> s
ExSewi::wh(/usr/src/Padre/Padre-Plugin-Debug/scripts/ExSewi.pm:24):
24:        s/\w+$/($`!)$&/;
                                                                                                                                       DB<3> s
ExSewi::wh(/usr/src/Padre/Padre-Plugin-Debug/scripts/ExSewi.pm:25):
25:        say $_;
                                                                                                                                       DB<3> X
@EXPORT_OK = (
    0  'wh'
    1  'eh'
)
@ISA = (
    0  'Exporter'
)
$VERSION = 0.01
                                                                                                                                       DB<3> s
He's out bowling with Fred tonight.
ExSewi::wh(/usr/src/Padre/Padre-Plugin-Debug/scripts/ExSewi.pm:27):
27:        return;
                                                                                                                                       DB<3> X
@EXPORT_OK = (
    0  'wh'
    1  'eh'
)
@ISA = (
    0  'Exporter'
)
$VERSION = 0.01
                                                                                                                                       DB<3> s
main::(sewi.pl:21):    say $fred;
                                                                                                                                       DB<3> .
main::(sewi.pl:21):    say $fred;
                                                                                                                                       DB<3> X
$/ = '
'
FileHandle(stderr) => fileno(2)
%SIG = (
    'ABRT' => undef
    'ALRM' => undef
    'BUS' => CODE(0xa292ac8)
       -> &CODE(0xa292ac8) in ???
    'CHLD' => undef
    'CLD' => undef
    'CONT' => undef
    'FPE' => 'IGNORE'
    'HUP' => undef
    'ILL' => undef
    'INT' => CODE(0xa266ea8)
       -> &DB::catch in 0
    'IO' => undef
    'IOT' => undef
    'KILL' => undef
    'NUM32' => undef
    'NUM33' => undef
    'NUM35' => undef
    'NUM36' => undef
    'NUM37' => undef
    'NUM38' => undef
    'NUM39' => undef
    'NUM40' => undef
    'NUM41' => undef
    'NUM42' => undef
    'NUM43' => undef
    'NUM44' => undef
    'NUM45' => undef
    'NUM46' => undef
    'NUM47' => undef
    'NUM48' => undef
    'NUM49' => undef
    'NUM50' => undef
    'NUM51' => undef
    'NUM52' => undef
    'NUM53' => undef
    'NUM54' => undef
    'NUM55' => undef
    'NUM56' => undef
    'NUM57' => undef
    'NUM58' => undef
    'NUM59' => undef
    'NUM60' => undef
    'NUM61' => undef
    'NUM62' => undef
    'NUM63' => undef
    'PIPE' => undef
    'POLL' => undef
    'PROF' => undef
    'PWR' => undef
    'QUIT' => undef
    'RTMAX' => undef
    'RTMIN' => undef
    'SEGV' => CODE(0xa292ac8)
       -> REUSED_ADDRESS
    'STKFLT' => undef
    'STOP' => undef
    'SYS' => undef
    'TERM' => undef
    'TRAP' => undef
    'TSTP' => undef
    'TTIN' => undef
    'TTOU' => undef
    'UNUSED' => undef
    'URG' => undef
    'USR1' => undef
    'USR2' => undef
    'VTALRM' => undef
    'WINCH' => 'readline::get_window_size'
    'XCPU' => undef
    'XFSZ' => undef
    '__DIE__' => CODE(0xa383030)
       -> &diagnostics::death_trap in 
/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/diagnostics.pm:550-586
    '__WARN__' => CODE(0xa382fe0)
       -> &diagnostics::warn_trap in 
/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/diagnostics.pm:538-548
)
$^L = "\cL"
$^ = 'OUT_TOP'
$$ = 6971
$\ = ''
$- = 0
@- = (
    0  0
    1  2
    2  6
)
FileHandle(DATA) => fileno(3)
$! = 'Invalid argument'
$^X = '/home/kevin/perl5/perlbrew/perls/perl-5.15.7/bin/perl5.15.7'
$^UNICODE = 0
$^V = v5.15.7
$= = 60
$2 = ''
$^WARNING_BITS = "\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@"
FileHandle(stdin) => fileno(0)
@INC = (
    0  '/usr/src/Padre/Padre-Plugin-Debug/scripts'
    1  
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/site_perl/5.15.7/i686-linux-thread-multi'
    2  '/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/site_perl/5.15.7'
    3  
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/i686-linux-thread-multi'
    4  '/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7'
    5  '.'
)
%INC = (
    'AutoLoader.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/AutoLoader.pm'
    'Carp.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/Carp.pm'
    'Clone.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/site_perl/5.15.7/i686-linux-thread-multi/Clone.pm'
    'Config.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/i686-linux-thread-multi/Config.pm'
    'Config_git.pl' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/i686-linux-thread-multi/Config_git.pl'
    'Config_heavy.pl' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/i686-linux-thread-multi/Config_heavy.pl'
    'Cwd.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/i686-linux-thread-multi/Cwd.pm'
    'Data/Printer.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/site_perl/5.15.7/Data/Printer.pm'
    'Devel/Peek.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/i686-linux-thread-multi/Devel/Peek.pm'
    'DynaLoader.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/i686-linux-thread-multi/DynaLoader.pm'
    'ExSewi.pm' => '/usr/src/Padre/Padre-Plugin-Debug/scripts/ExSewi.pm'
    'Exporter.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/Exporter.pm'
    'Exporter/Heavy.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/Exporter/Heavy.pm'
    'Fcntl.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/i686-linux-thread-multi/Fcntl.pm'
    'File/Basename.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/File/Basename.pm'
    'File/HomeDir.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/site_perl/5.15.7/File/HomeDir.pm'
    'File/HomeDir/Driver.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/site_perl/5.15.7/File/HomeDir/Driver.pm'
    'File/HomeDir/FreeDesktop.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/site_perl/5.15.7/File/HomeDir/FreeDesktop.pm'
    'File/HomeDir/Unix.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/site_perl/5.15.7/File/HomeDir/Unix.pm'
    'File/Spec.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/i686-linux-thread-multi/File/Spec.pm'
    'File/Spec/Unix.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/i686-linux-thread-multi/File/Spec/Unix.pm'
    'File/Which.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/site_perl/5.15.7/File/Which.pm'
    'FindBin.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/FindBin.pm'
    'Hash/FieldHash.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/site_perl/5.15.7/i686-linux-thread-multi/Hash/FieldHash.pm'
    'IO.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/i686-linux-thread-multi/IO.pm'
    'IO/Handle.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/i686-linux-thread-multi/IO/Handle.pm'
    'List/Util.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/i686-linux-thread-multi/List/Util.pm'
    'Scalar/Util.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/i686-linux-thread-multi/Scalar/Util.pm'
    'SelectSaver.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/SelectSaver.pm'
    'SelfLoader.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/SelfLoader.pm'
    'Sort/Naturally.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/site_perl/5.15.7/Sort/Naturally.pm'
    'Symbol.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/Symbol.pm'
    'Term/ANSIColor.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/Term/ANSIColor.pm'
    'Term/Cap.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/Term/Cap.pm'
    'Term/ReadKey.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/site_perl/5.15.7/i686-linux-thread-multi/Term/ReadKey.pm'
    'Term/ReadLine.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/Term/ReadLine.pm'
    'Term/ReadLine/Perl.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/site_perl/5.15.7/Term/ReadLine/Perl.pm'
    'Term/ReadLine/readline.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/site_perl/5.15.7/Term/ReadLine/readline.pm'
    'XSLoader.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/XSLoader.pm'
    'arybase.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/i686-linux-thread-multi/arybase.pm'
    'base.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/base.pm'
    'constant.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/constant.pm'
    'diagnostics.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/diagnostics.pm'
    'dumpvar.pl' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/dumpvar.pl'
    'feature.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/feature.pm'
    'integer.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/integer.pm'
    'lib.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/i686-linux-thread-multi/lib.pm'
    'locale.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/locale.pm'
    'parent.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/parent.pm'
    'perl5db.pl' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/perl5db.pl'
    'strict.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/strict.pm'
    'unicore/Heavy.pl' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/unicore/Heavy.pl'
    'unicore/lib/Perl/_PerlIDS.pl' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/unicore/lib/Perl/_PerlIDS.pl'
    'utf8.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/utf8.pm'
    'utf8_heavy.pl' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/utf8_heavy.pl'
    'vars.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/vars.pm'
    'warnings.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/warnings.pm'
    'warnings/register.pm' => 
'/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/warnings/register.pm'
)
$? = 0
$: = '
-'
$0 = 'sewi.pl'
$^S = 1
$@ = ''
$] = 5.015007
$^D = 0
FileHandle(STDERR) => fileno(2)
$, = ''
$" = ' '
$^F = 2
FileHandle(stdout) => fileno(1)
$| = 1
$^A = ''
$^RE_TRIE_MAXBUF = 65536
$~ = 'OUT'
You can't FIRSTKEY with the %~ hash at 
/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/dumpvar.pl line 382
     ...propagated at 
/home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/perl5db.pl line 
2471.
  at /home/kevin/perl5/perlbrew/perls/perl-5.15.7/lib/5.15.7/perl5db.pl 
line 2471
     DB::DB called at sewi.pl line 21
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<3>




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About