See https://rt.cpan.org/Ticket/Display.html?id=79656
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 ) =
--- /dev/null
+use strict;
+use warnings;
+use utf8;
+use Test::More;
+use Module::Metadata;
+
+# This test case tests about parsing pod after `__END__` token.
+
+my $pm_info = Module::Metadata->new_from_file('t/lib/ENDPOD.pm', collect_pod => 1,);
+is( $pm_info->name, 'ENDPOD', 'found default package' );
+is(join(',', $pm_info->pod_inside), 'NAME');
+
+done_testing;
+
--- /dev/null
+package ENDPOD;
+use strict;
+use warnings;
+use utf8;
+
+
+1;
+__END__
+
+=head1 NAME
+
+ENDPOD - End pod.
+