Each time you have an eval step inside the debugger, it replies with s.t. like:
main::((eval 8)[evals.pl:15]:1):
The string (eval 8) is the "file" name of the eval. You can use that name to list the eval.

The following example with the debugger illustrates the point. I will use this listing:

pp2@nereida:~/src/perl/testing$ cat -n evals.pl 1 use strict; 2 use warnings; 3 4 my ($a, $b) = (1, 9); 5 6 my $x = eval q { 7 $a = 2; 8 $b = 3; 9 print "$b\n"; 10 $a+$b; 11 }; 12 13 14 15 my $y = eval '$a+$b'; 16 17 print "$y\n";
See how the evals produce the "virtual filenames":
pp2@nereida:~/src/perl/testing$ perl -wd evals.pl Loading DB routines from perl5db.pl version 1.28 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(evals.pl:4): my ($a, $b) = (1, 9); DB<1> c 6 main::(evals.pl:6): my $x = eval q { main::(evals.pl:7): $a = 2; main::(evals.pl:8): $b = 3; main::(evals.pl:9): print "$b\n"; main::(evals.pl:10): $a+$b; DB<2> n main::((eval 6)[evals.pl:6]:2): $a = 2; DB<2> l (eval 6) 1 2==> $a = 2; 3: $b = 3; 4: print "$b\n"; 5: $a+$b; 6 7 ;
See it?. Now I try to stop at line 15
DB<3> c 15 Line 15 not breakable.
I fail because I am in file eval not in the main file:
DB<4> f evals.pl 1: use strict; 2: use warnings; 3 4: my ($a, $b) = (1, 9); 5 6: my $x = eval q { 7 $a = 2; 8 $b = 3; 9 print "$b\n"; 10 $a+$b; DB<5> c 15 3 main::(evals.pl:15): my $y = eval '$a+$b'; DB<6> n main::((eval 8)[evals.pl:15]:1): $a+$b DB<6> l (eval 8) 1==> $a+$b 2 ; DB<7> c 5 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<7>

In reply to Re: debugging eval'd code with source by casiano
in thread debugging eval'd code with source (SOLVED) by sharkey

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.