use strict;
use vars qw($VERSION);
-$VERSION = '1.000011';
+$VERSION = '1.000016';
$VERSION = eval $VERSION;
use Carp qw/croak/;
}
# Normalize versions. Can't use exists() here because of bug in YAML::Node.
- # XXX "bug in YAML::Node" comment seems irrelvant -- dagolden, 2009-05-18
+ # XXX "bug in YAML::Node" comment seems irrelevant -- dagolden, 2009-05-18
for (grep defined $_->{version}, values %prime) {
$_->{version} = $normalize_version->( $_->{version} );
}
my $pkg = 'main';
my $pod_sect = '';
my $pod_data = '';
+ my $in_end = 0;
while (defined( my $line = <$fh> )) {
my $line_num = $.;
} else {
+ # Skip after __END__
+ next if $in_end;
+
# Skip comments in code
next if $line =~ /^\s*#/;
# Would be nice if we could also check $in_string or something too
- last if $line =~ /^__(?:DATA|END)__$/;
+ if ($line eq '__END__') {
+ $in_end++;
+ next;
+ }
+ last if $line eq '__DATA__';
# parse $line to see if it's a $VERSION declaration
my( $vers_sig, $vers_fullname, $vers_pkg ) =
############################################################
# accessors
-sub name { $_[0]->{module} }
+sub name { $_[0]->{module} }
-sub filename { $_[0]->{filename} }
-sub packages_inside { @{$_[0]->{packages}} }
-sub pod_inside { @{$_[0]->{pod_headings}} }
-sub contains_pod { $#{$_[0]->{pod_headings}} }
+sub filename { $_[0]->{filename} }
+sub packages_inside { @{$_[0]->{packages}} }
+sub pod_inside { @{$_[0]->{pod_headings}} }
+sub contains_pod { 0+@{$_[0]->{pod_headings}} }
sub version {
my $self = shift;
=head1 DESCRIPTION
-This module provides a standard way to gather metadata about a .pm file
-without executing unsafe code.
+This module provides a standard way to gather metadata about a .pm file through
+(mostly) static analysis and (some) code execution. When determining the
+version of a module, the C<$VERSION> assignment is C<eval>ed, as is traditional
+in the CPAN toolchain.
=head1 USAGE