Skip to content

Commit

Permalink
Add filename and line number to string eval #10
Browse files Browse the repository at this point in the history
  • Loading branch information
miyagawa committed Mar 31, 2013
1 parent cddb822 commit b020a32
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Module/CPANfile.pm
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ no warnings;
my \$_result;
BEGIN { import Module::CPANfile::Environment \\\$_result };
# line 1 "$file"
$code;
\$_result;
Expand Down Expand Up @@ -336,4 +337,4 @@ Tatsuhiko Miyagawa
L<cpanfile>, L<CPAN::Meta>, L<CPAN::Meta::Spec>
=cut
=cut
9 changes: 9 additions & 0 deletions t/parse.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ use t::Utils;
setlocale(LC_ALL, $old_locale);
}

{
my $r = write_cpanfile(<<FILE);
foo();
FILE
eval { Module::CPANfile->load };
like $@, qr/cpanfile line 1/;
}


{
my $r = write_cpanfile(<<FILE);
configure_requires 'ExtUtils::MakeMaker', 5.5;
Expand Down

0 comments on commit b020a32

Please sign in to comment.