13 my $message = shift || '';
14 $message = "Error: $message\n" if $message;
20 Given a list of filenames, resolve any that look like perl module or script names.
28 sub HELP_MESSAGE
{usage
()}
31 getopts
('',\
%opt) or usage
();
34 my @res = map resolve
($_), @ARGV;
35 die "too many results\n" if @res > 5;
37 -f
or die "$_ not found\n";
44 my @resolvers = ( \
&resolve_file
,
49 foreach my $res ( @resolvers ) {
50 if( my @names = $res->($name) ) {
54 die "$name not found in file system, perl modules or perl scripts\n";
60 return $name if -f
$name;
62 return "./$name" if -f
"./$name";
68 return unless $name =~ /^\w+(::\w+)*$/;
70 my @comp = split /:+/,$name;
73 # so we can find modules in t/lib
74 my @test_INC = map { s
|/lib$|/t
/lib
| } @INC;
76 foreach my $inc ('.','./lib',@INC, @test_INC) {
77 my $fn = File
::Spec
->catfile($inc,@comp);
86 return if $name =~ m
|/|;
90 my $f = File
::Spec
->catfile($path,$name);
91 return $f if -f
$f; #<return just the one if exact match
92 grep !/~$/, glob( "$f*") #< otherwise, glob with that as the base
93 } split /:/,$ENV{PATH
};