#!/usr/bin/perl -w use strict; use Algorithm::Loops qw( Filter MapCarE ); Main( @ARGV ); exit( 0 ); sub Main { my @mods= @_; die "Usage: $0 Module::Name [...]\n" if ! @mods; my @files= Filter { s#::#/#g; s#'#/#g; $_ .= ".pm" if ! /\./; } @mods; my @paths= MapCarE { my( $mod, $file )= @_; if( ! eval { require $file; 1 } ) { warn "No such module ($mod); $file not found.\n"; (); } else { $INC{$file}; } } \@mods, \@files; exit( 1 ) if ! @paths; my $vi= $ENV{VISUAL} || $ENV{EDITOR} || "vi"; print STDERR "Running $vi...\n"; system( $vi, @paths ); print $_, $/ for @paths; }