in reply to Re: finding modules for perl 5.6.1
in thread finding modules for perl 5.6.1
If the perldoc for "Benchmark" appears, then you've got it - and the perldocs tell you how to use it.perldoc Benchmark
------------------------------------------------------#!/usr/bin/perl -w ###################################################################### +####### # Name: pwhich # Purpose: Perl version of "which" command # Takes In: 1. Perl module name (Ex: DBI, DBD::Oracle) # # Writes Out: Either a. "No documentation found for "XYZ" # # where "XYZ" is the name of a Perl module speci +fied # by the user that does *NOT* exist, # # Or b. line 1 - the @INC location of the perl module, + and # line 2 - the $Id version of the perl module ###################################################################### +####### use strict; my $ct_args = @ARGV; if ($ct_args != 1) { print "\nUsage: pwhich <perl module name>\n\n"; print "Example: pwhich DBI\n\n"; exit; } my $perl_module = shift; my $abs_filename = `perldoc -l $perl_module 2>&1`; print "\n"; print "$abs_filename"; if ($abs_filename =~ /^No documentation found/) { print "\n"; exit; } chomp($abs_filename); open(IN,"<$abs_filename") || die "Can't open $abs_filename!"; while (<IN>) { if (/\s*\$[\w:]*VERSION\s*=/i) { print; last; } } close(IN); print "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: finding modules for perl 5.6.1
by Sihal (Pilgrim) on Oct 07, 2002 at 14:16 UTC |