#!/usr/bin/perl -w ################################################################################# # # findINC # Wed Sep 5 2001 # Rich Reuter # # Find a perl module in @INC. Can match part or all of a module name. # ################################################################################# ####################################################### # Setup variables and packages ####################################################### use strict; use File::Find; my @dirs = @INC; # can use 'push(@dirs,"");' if there are dirs # that are used to store modules, but is not part of @INC my $module; ####################################################### # MAIN ####################################################### # Make sure that only one module name has been specified if ((!$ARGV[0]) || ($ARGV[1])) { die qq(Specify one module to search for!\n); } else { $module = $ARGV[0]; } # Substitute "::" with "/" to build path name $module =~ s|::|/|g; find (\&checkForModule, @dirs); sub checkForModule() { my $element = $File::Find::name; if ($element =~ $module) { # Re-substitute "/" with "::" for printing purposes $module =~ s|/|::|g; print qq($module matched at $element\n); } }