From: David Leadbeater <dgl@dgl.cx>
Date: Thu, 23 Dec 2010 00:19:14 +0000 (+0000)
Subject: Die if open fails in @INC handler
X-Git-Tag: v0.9.4~2
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=002ecfea279e0e4db46718a0b499f76155439e16;p=p5sagit%2FApp-FatPacker.git

Die if open fails in @INC handler

You'd think this impossible, but I was just testing with a broken perl
install where PerlIO::scalar's XS module didn't load.

"Can't locate XXX.pm in @INC" was a somewhat flummoxing error.
---

diff --git a/lib/App/FatPacker.pm b/lib/App/FatPacker.pm
index 4399341..aa3caef 100644
--- a/lib/App/FatPacker.pm
+++ b/lib/App/FatPacker.pm
@@ -171,7 +171,8 @@ sub script_command_file {
 
     unshift @INC, sub {
       if (my $fat = $fatpacked{$_[1]}) {
-        open my $fh, '<', \$fat;
+        open my $fh, '<', \$fat
+          or die "FatPacker error loading $_[1] (could be a perl installation issue?)";
         return $fh;
       }
       return