my @packages = PPI::Document->new('filename.pm') ->find('PPI::Statement::Package');