namishtiwari has asked for the wisdom of the Perl Monks concerning the following question:
It is not printing the correct output. the correct output is -- Total ArcotID count is -1187 Total QnA count is 74 Total OTP count is 4 Total User Password count is 2 but it is giving me- Total ArcotID count is 41 Total QnA count is 2 Total OTP count is 0 Total User Password count is 2 kindly give me some suggestions. I dont find any logic problem here. Thanks NT#!/usr/bin/perl Total_Number_Of_Transactions() ; sub Total_Number_Of_Transactions { my $logfile = $Logfile; my $logDir = $ARGV[0]; my $logPrefix = $ARGV[1]; die "usage: $0 <logDir> <logPrefix>" unless $logDir and $logPrefix; die "Log dir $logDir doesn't exist" unless -d "$logDir"; for my $logFile ( glob("$logDir/${logPrefix}*") ) { open($log, "<", $logFile) or die "Can't open $logFile for reading."; open(FP_OUT,">total_transactions") or die "cannot create file total_tr +ansactions for writing"; } my $Total_QnA_Count = 0; my $Total_OTP_Count = 0; my $Total_UP_Count = 0; my $Total_ArcotID_Count = 0; my $Success_QnA_Count =0; my $Failure_QnA_Count = 0; my $Success_ArcotID_Count = 0; my $Failure_ArcotID_Count = 0; my $Success_OTP_Count = 0; my $Failure_OTP_Count = 0; my $Success_UP_Count = 0; my $Failure_UP_Count = 0; OUTER: while( $line = <$log> ) { $line =~ tr/\r\n//d; if ($line =~ /Arcot Native Server: recvd AA_BIN_MSG_VER_CHG/) { while ($line = <$log>) { if ($line =~ /ArcotID\s*Auth\s*SUCCESS.*/) { $Success_ArcotID_Count++; next OUTER; } elsif ($line =~ /Auth failed.*/) { $Failure_ArcotID_Count++; next OUTER; } } } if ($line =~ /QNA Step - AUTH IN PROGRESS/) { while ($line = <$log>) { if ($line =~ /QNA Auth - Success.*/) { $Success_QnA_Count++; next OUTER; } elsif ($line =~ /Message: QNA Auth Failed.*/) { $Failure_QnA_Count++; next OUTER; } } } if ($line =~ /Entering OTPAuthModule::authenticate/) { while ($line = <$log>) { if ($line =~ /OTP SUCCESS.*/) { $Success_OTP_Count++; next OUTER; } elsif ($line =~ /Message: OTP FAILED.*/) { $Failure_OTP_Count++; next OUTER; } } } if ($line =~ /Entering UPAuthModule::authenticate/ .. /Sending Inv +alid credential/) { while ($line = <$log>) { if ($line =~ /UPAuth SUCCESS.*/) { $Success_UP_Count++; next OUTER; } elsif ($line =~ /UPAuth FAILED.*/) { $Failure_UP_Count++; next OUTER; } } } } $Total_ArcotID_Count = $Success_ArcotID_Count + $Failure_ArcotID_Count + ; $Total_QnA_Count = $Success_QnA_Count + $Failure_QnA_Count ; $Total_OTP_Count = $Success_OTP_Count + $Failure_OTP_Count ; $Total_UP_Count = $Success_UP_Count + $Failure_UP_Count ; printf FP_OUT "Total ApricotID count is $Total_ArcotID_Count\n"; printf FP_OUT "Total QnA count is $Total_QnA_Count\n"; printf FP_OUT "Total OTP count is $Total_OTP_Count\n"; printf FP_OUT "Total User Password count is $Total_UP_Count\n"; close(FP_OUT); close($log); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problem in output
by davorg (Chancellor) on Jun 29, 2009 at 14:16 UTC | |
by namishtiwari (Acolyte) on Jun 29, 2009 at 14:22 UTC | |
by davorg (Chancellor) on Jun 29, 2009 at 14:48 UTC | |
|
Re: problem in output
by Util (Priest) on Jun 29, 2009 at 15:47 UTC | |
|
Re: problem in output
by jethro (Monsignor) on Jun 29, 2009 at 14:37 UTC | |
by Marshall (Canon) on Jun 29, 2009 at 16:44 UTC | |
|
Re: problem in output
by ikegami (Patriarch) on Jun 29, 2009 at 16:52 UTC | |
|
Re: problem in output
by toolic (Bishop) on Jun 29, 2009 at 14:52 UTC |