PPI icon indicating copy to clipboard operation
PPI copied to clipboard

Line numbers not working after clone

Open vsespb opened this issue 10 years ago • 0 comments

use PPI;
use PPI::Find;
my $src = q{f($x, $z, $x);};
my $doc = PPI::Document->new(\$src);
my $finder = PPI::Find->new( sub {
    $_[0]->isa('PPI::Statement');
});
$finder->start($doc);
while ( my $token = $finder->match ) {
    #print "lineA ", $token->line_number, $token->column_number, "\n";
    my $t = $token->clone;
    print "lineB ", $t->line_number, $t->column_number, "\n";
}

prints

lineB 
lineB

but if I uncomment "lineA" print:

lineA 11
lineB 11
lineA 13
lineB 13

vsespb avatar May 28 '14 09:05 vsespb