gupr1980 has asked for the wisdom of the Perl Monks concerning the following question:
We call perl scripts from within a IBM tool. The way we do this is make a call to JAVA runtime process and run a perl command on the server, the java process returns the output/error of the PERL script. In our testing we found at times the java process just hangs. Looks like the PERL script doesnt throw any output or error and just quits??
code is below
earlier i had use autodie but then took it out. I am new to PERL, is there a case where a PERL script can just quit and not throw any. Should i use "use autodie"?=cut use strict; use warnings; my $infilename = $ARGV[0]; my $outfilename = $ARGV[1]; my $header = $ARGV[2]; my $readoffset = $ARGV[3]; my $readreccnt = $ARGV[4]; my $inreccnt = 0; my $outreccnt = 0; print "StartTime:"; print scalar localtime(time); open my $INFILE, '<', $infilename; seek $INFILE, $readoffset, 0; open my $OUTFILE, '>>', $outfilename; if ($artheader ne 'NOHDR'){ $artheader =~ tr/'^'/' '/; print $OUTFILE "$header\n"; $outreccnt++; } READLOOP: while (<$INFILE>){ $inreccnt++; if ($inreccnt > $readreccnt){ last READLOOP; } s/^HHH\.S.*//s; s/^EEE\.S.*//s; s/^0000\S{4}\s{2}//; print $OUTFILE $_; $outreccnt++; } close $INFILE; close $OUTFILE; print ",EndTime:"; print scalar localtime(time); print ",\n"; print "InFileName:"; print $infilename; print ",ReadOffset:"; print $readoffset; print ",ReadRecordCnt:"; print $readreccnt; print ",OutFileName:"; print $outfilename; print ",OutRecordCnt:"; print $outreccnt; print ",\n"; print "HeaderLen:"; print (length $artheader); print ",HeaderData:"; print $header; print ",\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: can PERL just quit?
by Eily (Monsignor) on Jun 09, 2014 at 21:39 UTC | |
by LanX (Saint) on Jun 09, 2014 at 21:44 UTC | |
by Eily (Monsignor) on Jun 09, 2014 at 22:03 UTC | |
by Anonymous Monk on Jun 09, 2014 at 22:17 UTC | |
Re: can PERL just quit?
by LanX (Saint) on Jun 09, 2014 at 21:37 UTC | |
Re: can PERL just quit?
by LanX (Saint) on Jun 09, 2014 at 22:45 UTC | |
Re: can PERL just quit?
by boftx (Deacon) on Jun 09, 2014 at 21:24 UTC | |
by gupr1980 (Acolyte) on Jun 09, 2014 at 21:33 UTC | |
by Laurent_R (Canon) on Jun 09, 2014 at 21:40 UTC | |
by gupr1980 (Acolyte) on Jun 10, 2014 at 01:11 UTC | |
by boftx (Deacon) on Jun 09, 2014 at 21:37 UTC | |
by marto (Cardinal) on Jun 10, 2014 at 08:27 UTC | |
by Anonymous Monk on Jun 10, 2014 at 06:45 UTC | |
by runrig (Abbot) on Jun 10, 2014 at 18:37 UTC | |
Re: can PERL just quit?
by sundialsvc4 (Abbot) on Jun 09, 2014 at 21:40 UTC | |
by Anonymous Monk on Jun 09, 2014 at 22:20 UTC | |
| |
Re: can PERL just quit?
by blue_cowdawg (Monsignor) on Jun 10, 2014 at 18:05 UTC |
Back to
Seekers of Perl Wisdom