Open p5pRT opened 8 years ago
The documentations says: http://perldoc.perl.org/perldebguts.html#Debugger-Internals Values in this array are magical in numeric context: they compare equal to zero only if the line is not breakable.
But that is not true.
How to reproduce: $ perl -d:DebugHooks::Terminal -e 1 -e 0: use Devel::DebugHooks::Terminal; >>x1: 1 e 1+1 2 f 0 (eval 2)[/home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Devel/DebugHooks.pm:627] 1 -e 2 -e 3 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/Exporter.pm 4 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/Exporter.pm 5 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/XSLoader.pm 6 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/XSLoader.pm 7 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/overload.pm 8 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/overload.pm 9 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/overloading.pm 10 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/overloading.pm 11 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/strict.pm 12 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/strict.pm 13 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/subs.pm 14 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/subs.pm 15 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/vars.pm 16 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/vars.pm 17 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/warnings.pm 18 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/warnings.pm 19 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/warnings/register.pm 20 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/warnings/register.pm 21 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Data/Dump.pm 22 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Data/Dump.pm 23 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Devel/DebugHooks.pm 24 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Devel/DebugHooks.pm 25 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Devel/DebugHooks/CmdProcessor.pm 26 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Devel/DebugHooks/CmdProcessor.pm 27 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Devel/DebugHooks/Commands.pm 28 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Devel/DebugHooks/Commands.pm 29 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Devel/DebugHooks/Terminal.pm 30 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Devel/DebugHooks/Terminal.pm 31 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/x86_64-linux/Guard.pm 32 /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/x86_64-linux/Guard.pm f 0 (eval 2)[/home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Devel/DebugHooks.pm:627] l 0 (eval 2)[/home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Devel/DebugHooks.pm:627] Argument "BEGIN{\n" isn't numeric in numeric ne (!=) at /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Devel/DebugHooks.pm line 589\, \<> line 6. 1: BEGIN{ Argument "^I( $^H\, ${^WARNING_BITS}\, my $hr ) = @DB::context[1..3..." isn't numeric in numeric ne (!=) at /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Devel/DebugHooks.pm line 589\, \<> line 6. 2: ( $^H\, ${^WARNING_BITS}\, my $hr ) = @DB::context[1..3]; Argument "^I%^H = %$hr if $hr;\n" isn't numeric in numeric ne (!=) at /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Devel/DebugHooks.pm line 589\, \<> line 6. 3: %^H = %$hr if $hr; Argument "}\n" isn't numeric in numeric ne (!=) at /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Devel/DebugHooks.pm line 589\, \<> line 6. 4: } Argument "; package main;\n" isn't numeric in numeric ne (!=) at /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Devel/DebugHooks.pm line 589\, \<> line 6. 5: ; package main; x6: 1+1 Argument ";" isn't numeric in numeric ne (!=) at /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Devel/DebugHooks.pm line 589\, \<> line 6. 7: ;l 0 (eval 2)[/home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Devel/DebugHooks.pm:627] 1: BEGIN{ 2: ( $^H\, ${^WARNING_BITS}\, my $hr ) = @DB::context[1..3]; 3: %^H = %$hr if $hr; 4: } 5: ; package main; x6: 1+1 7: ;l 0 (eval 2)[/home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Devel/DebugHooks.pm:627] 1: BEGIN{ 2: ( $^H\, ${^WARNING_BITS}\, my $hr ) = @DB::context[1..3]; 3: %^H = %$hr if $hr; 4: } 5: ; package main; x6: 1+1 7: ;
As you can see at example above comparison is not magic first time only for non breakable lines at source code. When we do comparison second and third time there is no warnings.
Another case I have noticed\, but this is perl 5.14
(eval 50)[/usr/local/share/perl/5.14.2/Mojo/Loader.pm:23] >>x1: require FH; 1 Argument ";" isn't numeric in numeric ne (!=) at /home/kes/perl_lib/lib/perl5/Devel/DebugHooks.pm line 593\, \<> line 16. 2:;
https://github.com/KES777/Devel-DebugHooks/blob/master/lib/Devel/DebugHooks.pm#L593
return ($line\<0?-$line-1:$line) \<= $#{ "::_\<$file" } && ${ "::_\<$file" }[ $line ] != 0;
On Thu Jun 23 09:25:22 2016\, kes-kes@yandex.ru wrote:
The documentations says: http://perldoc.perl.org/perldebguts.html#Debugger-Internals Values in this array are magical in numeric context: they compare equal to zero only if the line is not breakable.
But that is not true.
How to reproduce: ... skipped lots of stuff ... Argument "BEGIN{\n" isn't numeric in numeric ne (!=) at /home/kes/perl5/perlbrew/perls/perl- 5.24.0/lib/site_perl/5.24.0/Devel/DebugHooks.pm line 589\, \<> line 6.
etc.
It seems that the array of source lines (@{"_\<$filename"}) does not have a numeric value for unbreakable lines. That means that you get a non-numeric warning. Nevertheless\, it still compares equal to 0 numerically\, so technically the documentation is correct.
Iām not saying something shouldnāt be fixed. Maybe itās the documentation that needs clarification.
--
Father Chrysostomos
The RT System itself - Status changed from 'new' to 'open'
Migrated from rt.perl.org#128466 (status was 'open')
Searchable as RT128466$