Subject: | PPI doesn't find 'all' variables |
Show quoted text
> PPI doesn't find 'all' variables:
>
> My script:
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
> use PPI;
> use Data::Dumper;
>
> my $doc = PPI::Document->new('./UPC/Window.pm');
>
> my @vars = map{$_->variables}@{$doc->find('PPI::Statement::Variable')};
> print Dumper(\@vars);
>
> The parsed Module:
>
> package UPC::Window;
>
> use strict;
> use warnings;
> use Tk;
> use Tk::Zinc;
>
> use base 'Tk::MainWindow';
>
> our $VERSION = '0.01';
> our %CONFIG = ();
>
> sub new{
> my ($class) = @_;
> my $self = {};
> bless $self,$class;
>
> return $self;
> }# new
>
> sub build_display{
> }# build_display
>
> sub run{
> }# run
>
> $class is missed. In the anonymous array returned by $doc->find() you
> can find the variable, but it gets lost when calling ->variables.
My system:
PPI 1.003
Perl5.8.7 (ActivePerl)
WinXP Home