From: Gisle Aas Date: Wed, 2 Oct 1996 22:00:35 +0000 (+0200) Subject: Yet another perldoc option X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a2333f3625faa17fb193cfa25c3d598cb59f105f;p=p5sagit%2Fp5-mst-13.2.git Yet another perldoc option Subject: Re: Yet another perldoc option I have added a new option to perldoc that just make it print the file name of the module found. This enables me to say things like: $ grep VERSION $(perldoc -l lwp) which I find handy. This is also handy for various scripts that want to reuse perldoc's module search algorithm. Perhaps this really should have been made into a proper module. The 'l' was inspired by grep(1). p5p-msgid: <199610022200.AAA15334@furubotn.sn.no> --- diff --git a/utils/perldoc.PL b/utils/perldoc.PL index 88608cf..7d62c07 100644 --- a/utils/perldoc.PL +++ b/utils/perldoc.PL @@ -47,7 +47,7 @@ print OUT <<'!NO!SUBS!'; if(@ARGV<1) { die < 1; +usage("only one of -t, -u, -m or -l") if $opt_t + $opt_u + $opt_m + $opt_l > 1; if ($opt_t) { require Pod::Text; import Pod::Text; } @@ -222,6 +223,11 @@ if(!@found) { exit ($Is_VMS ? 98962 : 1); } +if ($opt_l) { + print join("\n", @found), "\n"; + exit; +} + if( ! -t STDOUT ) { $opt_f = 1 } unless($Is_VMS) { @@ -301,7 +307,7 @@ perldoc - Look up Perl documentation in pod format. =head1 SYNOPSIS -B [B<-h>] [B<-v>] [B<-t>] [B<-u>] PageName|ModuleName|ProgramName +B [B<-h>] [B<-v>] [B<-t>] [B<-u>] [B<-m>] [B<-l>] PageName|ModuleName|ProgramName =head1 DESCRIPTION @@ -342,6 +348,10 @@ This may be useful if the docs don't explain a function in the detail you need, and you'd like to inspect the code directly; perldoc will find the file for you and simply hand it off for display. +=item B<-l> file name only + +Display the file name of the module found. + =item B The item you want to look up. Nested modules (such as C) @@ -368,10 +378,6 @@ Kenneth Albanowski Minor updates by Andy Dougherty -=head1 SEE ALSO - -=head1 DIAGNOSTICS - =cut #