Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

O monks, I've found anomalous behavior with the Perl debugger, and I'd like a sanity check.

Here's a simple script that demonstrates the issue — at least on my laptop with a recent Xubuntu, Perl 5.26.1 and v 1.51 (my Win7 machine with Strawberry Perl 5.28.2 doesn't have this problem). The script does a global regex replace on its first arg (word).

#!/bin/perl -w use strict; $_ = shift // ''; # line 3 s{a([bc])} # 4 {d$1}g; # 5 print; # 6

Open this in the debugger, l(ist) the script, and the 'print;' line is tagged line 5, not 6. The debugger doesn't find the script's line 5 ... although the script runs fine (e.g., the single arg 'abacadbd' yields 'dbdcadbd'). The debugger applies the commands 'c 5' and 'b 5' to the 'print;' line.

With one or more multiline replace statements in the middle of a sizable script, this gets aggravating. Further, it's a tough problem to Google — a possible bug in the debugger, etc.

Any resonance from No-Mind?

In reply to Debugger line numbering anomaly by lzipin

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2022-05-18 14:28 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (71 votes). Check out past polls.