Permalink
Browse files

localize $@ and don't use $! because it causes 5.8 to fail, and also …

…it's not actually used.
  • Loading branch information...
1 parent 4a90afe commit 438fc19fa3bb36ed78c7b314b8d2cd36f7fea346 @miyagawa committed Apr 7, 2012
Showing with 13 additions and 3 deletions.
  1. +5 −1 Changes
  2. +8 −2 lib/CPAN/cpanfile/Environment.pm
View
@@ -1,5 +1,9 @@
+0.9003 Sat Apr 7 01:26:04 PDT 2012
+ - Don't use $! in error checks because we don't open file there.
+ This also caused issues in 5.8 where $! isn't often cleared
+
0.9002 Sat Apr 7 01:14:00 PDT 2012
- - Fixed the test again to not fail on 5.8 where do() is cached
+ - Fixed the test again to not fail on 5.8
0.9001 Tue Apr 3 04:30:31 CEST 2012
- Added t/samples in the directory so the test won't fail
@@ -29,7 +29,11 @@ sub parse {
join '', <$fh>;
};
- my $res = eval sprintf <<EVAL, $file_id++;
+ my($res, $err);
+
+ {
+ local $@;
+ $res = eval sprintf <<EVAL, $file_id++;
package CPAN::cpanfile::Sandbox%d;
my \$_result;
no warnings;
@@ -39,8 +43,10 @@ $code;
\$_result;
EVAL
+ $err = $@;
+ }
- if (my $err = $@ || $!) { die "Parsing $file failed: $err" };
+ if ($err) { die "Parsing $file failed: $err" };
return $res;
}

0 comments on commit 438fc19

Please sign in to comment.