Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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
=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";
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"?

In reply to can PERL just quit? by gupr1980

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-03-29 09:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found