don't fail tracing w/undef INC values due to failed optional module load
[p5sagit/App-FatPacker.git] / lib / App / FatPacker / Trace.pm
index 526a318..39c13a8 100644 (file)
@@ -8,7 +8,7 @@ my $trace_file;
 my %initial_inc;
 
 sub import {
-  my(undef, $file, @extras) = @_;
+  my (undef, $file, @extras) = @_;
 
   $trace_file = $file || '>>fatpacker.trace';
   # For filtering out our own deps later.
@@ -28,8 +28,9 @@ CHECK {
   open my $trace, $trace_file
       or die "Couldn't open $trace_file to trace to: $!";
 
-  for my $inc(keys %INC) {
+  for my $inc (keys %INC) {
     next if exists $initial_inc{$inc};
+    next unless defined($INC{$inc}) and $INC{$inc} =~ /\Q${inc}\E\Z/;
     print $trace "$inc\n";
   }
 }
@@ -79,7 +80,7 @@ from the command line as such:
 
     perl -MApp::FatPacker::Trace [...]
 
-You can control the paramters to the import using an equal sign, as such:
+You can control the parameters to the import using an equal sign, as such:
 
     # send the parameter "hello"
     perl -MApp::FatPacker::Trace=hello [...]