PPIx::IndexOffsets - Index offsets for tokens in PPI
my $document = PPI::Document->new( 'hello.pl' ); $document->index_offsets; my @tokens = $document->tokens; foreach my $token ( $document->tokens ) { my $start_offset = $token->start_offset; my $stop_offset = $token->stop_offset; print "$start_offset .. $stop_offset $token\n"; }
PPIx::IndexOffsets is a module which indexes the start and stop offsets for all the tokens in a PPI document tree.
PPI.
Leon Brocard, <acme@astray.com>
<acme@astray.com>
Copyright (C) 2008, Leon Brocard
This module is free software; you can redistribute it or modify it under the same terms as Perl itself.
To install PPI::Document, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PPI::Document
CPAN shell
perl -MCPAN -e shell install PPI::Document
For more information on module installation, please visit the detailed CPAN module installation guide.