After a Perl script that configures disk space alarms on the new Linux server (Red Hat Enterprise linux Server Release 5.7 (tikanga)), the test times follows the following error
[Oracle@db-server scripts]$./disk_capatiy_alarm.sh
Can ' t locate mail/sender.pm in @INC (@INC contains:/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/usr/ Lib/perl5/site_perl/5.8.8/usr/lib/perl5/site_perl/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/ usr/lib/perl5/vendor_perl/5.8.8/usr/lib/perl5/vendor_perl/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/usr/ lib/perl5/5.8.8.) at/home/oracle/scripts/output/disk_sendmail.pl Line 2.
BEGIN failed--compilation aborted at/home/oracle/scripts/output/disk_sendmail.pl line 2.
The Perl script disk_sendmail.pl as follows, which uses the Mail-sender mail module,
#!/usr/bin/perl use
mail::sender;
$sender = new Mail::sender {smtp => ' xxx.xxx.xxx.xxx ', from => ' xxx@xxx.com '};
$sender->mailfile ({to => ' xxx@xxx.com ',
cc=> ' xxx@xxx.com ', subject => ' The
server xxxx\ ' s Disk Capacity Alarm ',
msg => ' Dear all, the
server xxxx disk Capacity Alarm, please take action for it. Many thanks!
',
file => '/home/oracle/scripts/output/diskdetail.txt '});
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/extra/
This error occurs because Perl does not have the Mail-sender module installed, the problem of installing this module is resolved, and the Mail::sender module supports sending messages with attachments. There are several ways to install
1: Use CPAN installation, require the server to access the extranet, otherwise can not download the related package.
Cpan> Install Mail::sender
2: Download perl-mail-sender-0.8.16-1.el5.pp.noarch.rpm
Download Address: http://rpm.pbone.net/index.php3/stat/4/idpl/10370607/dir/redhat_el_5/com/ Perl-mail-sender-0.8.16-1.el5.pp.noarch.rpm.html
[Root@db-server oracle]# RPM-IVH perl-mail-sender-0.8.16-1.el5.pp.noarch.rpm
Warning:perl-mail-sender-0.8.16-1.el5.pp.noarch.rpm:header V3 DSA Signature:nokey, key ID 6971f6ac
Preparing ... ########################################### [100%]
1:perl-mail-sender ########################################### [100%]
3: Download and install mail-sender-0.8.16.tar.gz. I have not experimented with this method because http://search.cpan.org/CPAN/authors/id/J/JE/JENDA/Mail-Sender-0.8.16.tar.gz is always unable to download the installation package.
Author: The Hermit of Xiaoxiang
Source: http://www.cnblogs.com/kerrycode/