[Parseperl-discuss] PPI to get package/versions
Brought to you by:
adamkennedy
From: Todd R. <to...@cp...> - 2010-03-11 00:14:01
|
I want to use PPI to determine all packages and their $VERSION in a given pm file. I've determined how to get the list of packages in the file, but not the version. How can I do this? I've included what I have so far: use PPI; my $file = 'Uplevel.pm'; # Testing with Sub::Uplevel for POC my $doc = PPI::Document->new($file) or die; my $pkgs = $doc->find('PPI::Statement::Package'); foreach my $pkg (@$pkgs) { my $package_name = $pkg->namespace; # I don't know how to get the $VERSION from here. } |