我有一个perl脚本,我试图在RHEL(Linux)6.6中执行,我收到以下错误。可以请在这个Perl脚本中指导我做错了什么:
-numeric_limits<T>::min()
所以如果有人能帮我解决这个问题,我将不胜感激。
谢谢我没有找到zcat错误BUt我得到以下内容,当我执行此脚本时:
#!/usr/bin/perl
use strict;
open( LOG, ">>/tmp/test.log" ) or die;
my $application;
my $format = "%-10s %-50s Login Fails %7s\n";
for ( my $i = 0 ; $i <= $#ARGV ; $i++ ) {
print LOG "i=$i arg is <$ARGV[$i]>\n";
if ( $i == 2 ) {
my $tmp = $ARGV[$i];
# print LOG "**** found $tmp\n";
grep ( s/.*SYSTEM=\"(.*)\"/$application=$1/e, $tmp );
# print LOG "**** extracted <$application>\n";
}
}
# arg 7 has the gzipped output
print LOG "\n";
my @file = `/bin/zcat $ARGV[7]`;
#print LOG "printing zcat file \n";
for ( my $i = 1 ; $i <= $#file ; $i++ ) {
chomp $file[$i];
my ( $uid, $email, $count ) = split( /,/, $file[$i] );
# print LOG "$uid login fails = $count\n";
$count = commify($count);
printf LOG ( $format, $uid, $email, $count );
mailit( $uid, $email, $count );
}
print LOG "\nExit\n\n";
exit;
sub commify {
# commify a number. Perl Cookbook, 2.17, p. 64
my $text = reverse $_[0];
$text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g;
return scalar reverse $text;
}
sub mailit {
my ( $uid, $email, $count ) = @_;
open( HELP, "/opt/splunk/bin/scripts/lockout.help" ) or die " no help\n";
my @help = <HELP>;
close HELP;
my $date = `/bin/date`;
chomp $date;
my $program = $0;
my $message;
$message = $message . "Program: $program<br/>";
$message = $message . "Date: $date<br/>";
$message = $message . "Email: $email<br/>";
$message = $message . "User: $uid<br/>";
$message = $message . "Failure Count: $count<p>";
foreach (@help) {
chomp;
$message = $message . $_;
}
open( MAIL, "|/usr/sbin/sendmail -t" );
## Mail Header
print MAIL "To: Mohiuddin, Mohammed\@truvenhealth.com\n";
print MAIL "From: Security\@truvenhealth.com\n";
print MAIL "Subject: Failed Logins ACTION REQUIRED!\n";
## Mail Body
print MAIL "Content-Type: text/html; charset=utf-8\n\n" . "<html><head> </hea
d><body> <font face=\"verdana\">$message</font> ";
close(MAIL);
}