| Category: | Utilities scripts |
| Author/Contact Info | Michael K. Neylon - mneylon-pm@masemware.com |
| Description: | Quick command line script that allows one to locate where a module is installed in @INC, returning the full path to that module. If you're like me, having upgraded perl incrementally via standard distro packages, you might have upwards of 10 or so @INC directors, making searching them all a bit difficult. Even with simply ways to determine if a module is installed in the first place, it doesn't tell exactly where. This script uses the Module::Info module to do it's work. I'd recommend running this explicitly with 'perl' in front of it, as as long as you've installed the Module::Info on each perl installation that you have, you can run it as such:
(Of course, you're free to change the perl intrepreter in the shebang to do this and have multiple copies of this script in the path to do this, but in this way, you won't have to remember which script is for which perl, etc.) |
#!/usr/bin/perl -w use strict; use Module::Info; my $usage = <<USAGE; $0 <module_name> - Locate the directory for a perl module <module_name> - Name of perl module (required) Copyright (C) 2001, Michael K. Neylon USAGE ( print $usage and exit 0 ) if !$ARGV[0]; my $module = Module::Info->new_from_module( $ARGV[0] ); ( print "Module $ARGV[0] not found\n" and exit 0 ) if !$module; print $module->inc_dir, "\n"; exit 1; |
|
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: wheremod.pl - Locate Modules in @INC
by VSarkiss (Monsignor) on Dec 01, 2001 at 21:33 UTC |