http://www.perlmonks.org?node_id=1225829

LanX has asked for the wisdom of the Perl Monks concerning the following question:

Hi

I'm not sure but it seems like B::Xref is buggy, after running perl -MO=Xref,-r,-d tst_b_xref.pl

with 5.24 Activestate on

D:\tmp>perl -c tst_b_xref.pl tst_b_xref.pl syntax OK D:\tmp>more tst_b_xref.pl use strict; my $sth; my $lines; while ( my @row = $sth->fetchrow_array ) { #5 print "@row.\n"; #7 push @{$lines},+{status => $row[0]}; #9 }

I'm getting

tst_b_xref.pl (main) 2 (lexical) $ sth + intro tst_b_xref.pl (main) 2 (lexical) $ lines + intro tst_b_xref.pl (main) 7 main $ " + used tst_b_xref.pl (main) 7 (lexical) @ row + used tst_b_xref.pl (main) 9 (lexical) $ lines + used tst_b_xref.pl (main) 9 (lexical) @$ lines + used tst_b_xref.pl (main) 9 (lexical) $ sth + used tst_b_xref.pl (main) 9 (lexical) $ sth + subused tst_b_xref.pl (main) 9 (lexical) @ row + intro

please note that @row was "intro"-duced in line 5 inside while and "used" in line 7 and 9,

But the output says used in 7 and introduced in 9, which doesn't really make sense.

(I'm taking no issues (yet) on the "$ sth subused" line which is reporting the ->fetchrow method call.)

update
Reproduced with 5.18 under Ubuntu
$ cat /tmp/xref.out tst_b_xref.pl (main) 2 (lexical) $ sth + intro tst_b_xref.pl (main) 3 (lexical) $ lines + intro tst_b_xref.pl (main) 7 main $ " + used tst_b_xref.pl (main) 7 (lexical) @ row + used tst_b_xref.pl (main) 9 (lexical) $ lines + used tst_b_xref.pl (main) 9 (lexical) @$ lines + used tst_b_xref.pl (main) 9 (lexical) $ sth + used tst_b_xref.pl (main) 9 (lexical) $ sth + subused tst_b_xref.pl (main) 9 (lexical) @ row + intro

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

update

Added line numbers

update

Perl seems to optimise to my ($sth,$lines);', that's why '$lines is reported at line 2 not 3.