Skip to content

Commit

Permalink
fix test for parsing POD errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mickeyn committed Apr 21, 2016
1 parent 792c441 commit 5f3d4fc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/MetaCPAN/Document/File.pm
Expand Up @@ -160,17 +160,20 @@ sub _build_description {
= MetaCPAN::Util::extract_section( ${ $self->content },
'DESCRIPTION' );
return undef unless ($section);

my $parser = Pod::Text->new;
my $text = "";
my $text = q{};
$parser->output_string( \$text );

try {
$parser->parse_string_document("=pod\n\n$section");
}
catch {
warn $_[0];
warn $_;
};

return undef unless $text;

$text =~ s/\s+/ /g;
$text =~ s/^\s+//;
$text =~ s/\s+$//;
Expand Down
3 changes: 2 additions & 1 deletion t/document/file.t
Expand Up @@ -528,12 +528,13 @@ subtest 'pod parsing errors are not fatal' => sub {
package Foo;
use strict;
=head1 NAME
=head1 DESCRIPTION
Foo - mymodule1 abstract
POD

no warnings 'redefine';

local *Pod::Text::parse_string_document = sub {
die "# [fake pod error]\n";
};
Expand Down

0 comments on commit 5f3d4fc

Please sign in to comment.