Skip to content

check whether a Perl module is installed

for example: check modul Mail::Mailer

use the command:

# perl -MMail::Mailer -e 1

echo $?

You can find a version number like this:

# perl -MMail::Mailer -le ‘print $Mail::Mailer::VERSION’

Is the Modul not installed!

you can use perl on the command line

# perl -MCPAN -e shell (or direct perl -MCPAN -e “install Mail::Mailer”)

at CPAN prompt, enter:

cpan>get Mail::Mailer


and test the module Mail::Mailer=> here is short a perl script

#!/usr/bin/perl -w
use Mail::Mailer;
$from = “root”;
$to = “root”;
$subject = “Testing Mail Mailer Module”;
$BODY = “This is a test eMail”;

$mailer = Mail::Mailer->new();
$mailer->open({ From => $from,
To => $to,
Cc => “kraneis”,
Subject => $subject,
print $mailer $BODY;
or die “couldn’t send whole message: $!\n”;