############################################################
# 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;
--- /dev/null
+use strict;
+use warnings;
+use Test::More tests => 3;
+use Module::Metadata;
+
+{
+ my $src = <<'...';
+package Foo;
+1;
+...
+
+ open my $fh, '<', \$src;
+ my $module = Module::Metadata->new_from_handle($fh, 'Foo.pm');
+ ok(!$module->contains_pod(), 'This module does not contains POD');
+}
+
+{
+ my $src = <<'...';
+package Foo;
+1;
+
+=head1 NAME
+
+Foo - bar
+...
+
+ open my $fh, '<', \$src;
+ my $module = Module::Metadata->new_from_handle($fh, 'Foo.pm');
+ ok($module->contains_pod(), 'This module contains POD');
+}
+
+{
+ my $src = <<'...';
+package Foo;
+1;
+
+=head1 NAME
+
+Foo - bar
+
+=head1 AUTHORS
+
+Tokuhiro Matsuno
+...
+
+ open my $fh, '<', \$src;
+ my $module = Module::Metadata->new_from_handle($fh, 'Foo.pm');
+ ok($module->contains_pod(), 'This module contains POD');
+}