Tired of scrambling around @INC when you want to see a module's code? Let Perl find it!
Save this in a file in your search path (I called it vipm -- guess what editor I use). Then you can just say
or whatever.vipm Apache::Registry CGI #or vipm Apache/Registry.pm CGI.pm
Arguments starting with - are passed through. There's not a lot of error checking; give it stupid arguments, it'll probably do stupid things.
Share and enjoy.
#! /usr/bin/perl -w # # Find a module and edit it. Arguments should be either # "Perl" style: Apache::Registry # or "path" style: Apache/Registry.pm # # Any arguments starting with - are passed to editor unchanged. # foreach (@ARGV) { next if /^-/; s|/|::|g if s/\.pm$//; eval "require $_" or die "Module $_ didn't load\n"; s|::|/|g; } exec $ENV{EDITOR} || '/bin/vi', map {/^-/? $_ : $INC{$_ . '.pm'} } @AR +GV;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Find and edit module
by merlyn (Sage) on Sep 28, 2001 at 03:47 UTC | |
by VSarkiss (Monsignor) on Sep 29, 2001 at 01:06 UTC | |
(dkubb) Re: (1) Find and edit module
by dkubb (Deacon) on Sep 29, 2001 at 13:07 UTC | |
by jlf (Scribe) on Oct 13, 2001 at 01:56 UTC | |
Re: Find and edit module
by Jenda (Abbot) on May 29, 2004 at 17:03 UTC |