Subject: | Version plugin breaks if no package declaration found |
The Version section plugin breaks if there's no package declaration in
the PPI document:
weave_document() failed on 'script/podweaver': Can't call method
"namespace" without a package or object reference at
/usr/local/share/perl/5.10.1/Pod/Weaver/Section/Version.pm line 66.
Offending context is:
if ( exists $input->{ppi_document} ) {
my $pkg_node =
$input->{ppi_document}->find_first('PPI::Statement::Package');
$args{module} = $pkg_node->namespace if defined $pkg_node;
}
PPI::Node->find_first() returns undef only on error, it returns a
false-but-defined value if nothing is found, so line 66 should read:
$args{module} = $pkg_node->namespace if $pkg_node;