Thanks for the suggestion. I tried and it didn't work for me.
Here is something that sort of works but doesn't really.
In file /tmp/Devel/COP.pm:
package DB;
sub DB {
($pkg, $filename, $lineno) = caller;
$COP = 0;
local(*DB::dbline) = "::_<$DB::filename";
if (defined $DB::dbline[$lineno]) {
$COP = 0 + $DB::dbline[$lineno] ;
}
};
1;
And to test it, put in file /tmp/code-test.pl:
#!/usr/bin/perl
use B::Concise;
sub testit ()
{
my $walker = B::Concise::compile('-basic', '-src', 'testit');
B::Concise::set_style_standard('debug');
B::Concise::walk_output(\my $buf);
$walker->(); # walks and renders into $buf;
print $buf, "\n";
printf "COP is 0%x\n", $DB::COP;
}
testit();
Now run as perl -I/tmp d:COP /tmp/code-test.pl
The problem is that the COP address is always the first statement for the line. And what I really want is the one we are currently at which might not be the first COP of the line. Sigh.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Outside of code tags, you may need to use entities for some characters:
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|