in reply to Re^2: caller() returns wrong line on multi-line function call
in thread caller() returns wrong line on multi-line function call

The information in nextstate is used by the debugger to display the current line while stepping thru

Sorry, I don't think there is any room left to argue.

edit
The debugger can't work properly with this bug, and actually fails.

If you type v you'll see something like

DB<1> n main::tst(caller_subline.pl:24): do { A +=> 1, B => main::tst(caller_subline.pl:25): ); DB<1> v 21 22 23 print_calling_line( __LINE__, 24==> do { A => 1, B => 2, C => 3 } 25 ); 26 27 print_calling_line( __LINE__, 28: do { A => 1, B => 2, C => 3 }, 29: do { A => 1, B => 2, C => 3 , 30: do { A => 1, B => 2, C => 3 } DB<1> n Called from line 23; caller() reports line 24 main::tst(caller_subline.pl:29): do { A +=> 1, B =>

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

Replies are listed 'Best First'.
Re^4: caller() returns wrong line on multi-line function call (debugger confused)
by RonW (Parson) on Sep 16, 2017 at 00:36 UTC
    hence the line with the sub statement in our case

    In the OP's case, yes.

    I was talking about function calls in general. And for the case of displaying line numbers to a sentient being (which the OP did mention).

    For a debugger, yes, the line of number of start of the function call is needed to be able to display the function call correctly.

    Update: Though, for a GUI debugger, highlighting the line with the closing ) as long as there wasn't another function call on the same line.

    Certainly, the least ambiguous is to have the line number with the start of the call (either the function name or the sub).

    My main point of my previous post still remains: Anything line "in the middle" of the call is too ambiguous, therefore not acceptable.