To verify that you've got it, as with most(all?) standard Perl modules, provided you know the name of the module, you should be able to view the perldocs for that module - if the perldocs are present, then the module is present. At a command prompt, do
perldoc Benchmark
If the perldoc for "Benchmark" appears, then you've got it - and the perldocs tell you how to use it.
I'm also including a script that I wrote - I call it "pwhich", which on a *nix platform does the same thing as the "which" command - it tells you where in your search path a command exists. So, pwhich tells you where in your Perl search path(@INC) that the module appears, *AND* it tells you what version of the module is installed there - according to the $VERSION string found in the module:
-------------------------------------------------------
#!/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";
------------------------------------------------------
HTH.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.