Commit | Line | Data |
48af1939 |
1 | package App::FatPacker::Trace; |
2 | |
3 | use strict; |
4 | use warnings FATAL => 'all'; |
5 | use B (); |
6 | |
dc7a3a08 |
7 | my $trace_file; |
8 | my %initial_inc; |
9 | |
48af1939 |
10 | sub import { |
dc7a3a08 |
11 | $trace_file = $_[1] || '>>fatpacker.trace'; |
12 | # For filtering out our own deps later. |
13 | # (Not strictly required as these are core only and won't have packlists, but |
14 | # looks neater.) |
15 | %initial_inc = %INC; |
48af1939 |
16 | B::minus_c; |
17 | } |
18 | |
dc7a3a08 |
19 | CHECK { |
20 | return unless $trace_file; # not imported |
21 | |
22 | open my $trace, $trace_file |
23 | or die "Couldn't open $trace_file to trace to: $!"; |
24 | |
25 | for my $inc(keys %INC) { |
26 | next if exists $initial_inc{$inc}; |
27 | print $trace "$inc\n"; |
28 | } |
29 | } |
30 | |
48af1939 |
31 | 1; |