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

[perl #132653] Step-by-step debugging do not work for if elsif elsif

Thread Previous | Thread Next
From:
KES
Date:
December 25, 2017 09:20
Subject:
[perl #132653] Step-by-step debugging do not work for if elsif elsif
Message ID:
rt-4.0.24-17494-1514193599-1625.132653-75-0@perl.org
# New Ticket Created by  KES 
# Please include the string:  [perl #132653]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=132653 >


Very often in the program there are consecutive ifs. Like this:

$x = <>;

if( !$x ) {
    print 1;
}
elsif( $x eq 'asdf' ) {
    print 2;
}
elsif( $x ne 'asdf' ) {
    print 3;
}
else {
    print 4;
}

And this is unhandy when 's' debugger command skip all ifs and do not stop on each.
For example 'elsif'  is skipped on line 8:

$ perl -d ./t.pl 

Loading DB routines from perl5db.pl version 1.49_04
Editor support available.

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

main::(./t.pl:3):	$x = <>;
  DB<1> s
df
main::(./t.pl:5):	if( !$x ) {
  DB<1> s
main::(./t.pl:12):	    print 3;
  DB<1> 

expected debugging:

main::(./t.pl:3):	$x = <>;
  DB<1> s
df
main::(./t.pl:5):	if( !$x ) {
  DB<1> s
main::(./t.pl:8):	elsif( $x eq 'asdf' ) {
  DB<1> s
main::(./t.pl:12):	    print 3;
  DB<1> 


Thread Previous | Thread Next


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