in reply to Solved: splitting source file

Would be nice to honour @INC as use, require, and do. For example:
use File::Spec; # cdarke added use Filter::Util::Call; sub import { my (undef, @files) = @_; @files = find_files(@files); # cdarke added my (undef, $origin, $line) = caller; filter_add sub { # No change, but see below return 1; }; } # cdarke added sub find_files { my @in = @_; my @out; for my $file (@in) { my $found = 0; for my $dir (@INC) { my $path = File::Spec->catfile ($dir, $file); if (-r $path) { push @out,$path; $found = 1; last; } push @out,$path unless $found; } } return @out; } 1;
Personally I would prefer to use a lexical file handle, and to have some control over error handling?

Update: corrected inner loop - non-existant files were being ignored.