sub packlists_containing { my ($self, $targets) = @_; my @targets = @$targets; require $_ for @targets; my @search = grep -d $_, map catdir($_, 'auto'), @INC; my %pack_rev; my $cwd = cwd; find(sub { return unless $_ eq '.packlist' && -f $_; $pack_rev{$_} = $File::Find::name for lines_of $File::Find::name; }, @search); chdir($cwd) or die "Couldn't chdir back to ${cwd} after find: $!"; my %found; @found{map +($pack_rev{$INC{$_}}||()), @targets} = (); sort keys %found; }