#!/usr/bin/perl my $module = shift; # XXX add getopts stuff such as: # -c Run command on first match (e.g. -c edit) # ^-- reverse of "cmd $(which_module \n"; print "\t (use :: as path separator)\n"; exit; } # end subroutine usage definition ######################################################################## my @paths = split(/::/, $module); $paths[-1] .= ".pm"; my @search = @INC; foreach my $path (@paths) { for(my $i = 0; $i < @search; $i++) { if(-e $search[$i] . "/". $path) { # print "$search[$i]/$path good\n"; $search[$i] .= "/" . $path; } else { splice(@search, $i, 1); $i--; } } } print join("\n", @search), "\n";