[Chicago-talk] testing exit status of external program

Jim Thomason jthomasoniii at yahoo.com
Tue Dec 9 10:17:40 CST 2003


$?.

close (ES_CLIENT);
print "ES_CLIENT returned $?";

(incidentally, I didn't remember the variable name, I
just did a 'perldoc -f close' and got lucky)

-Jim......

--- "Dooley, Michael" <Dooley.Michael at con-way.com>
wrote:
> If I have a program like below how can I test the
> return value of the
> external program?
> 
> open (FILE, "./test.file");
> open (ES_CLIENT, "|shell_program");
> while (<FILE>) {
> print ES_CLIENT $_;"\n";
> }
> close (ES_CLIENT);
> close (FILE);
> 
> [qgatu003]/export/home/mxdooley/mbi_script$cat
> test.file |shell_program
> 16:06:32: info: broker_path=qgatu003
> 16:06:32: warning: connect=10.40.11.28:9701
> (Connection refused, tcp)
> 16:06:33: warning:
> broker_malfunction=10.40.11.28:9701
> (reason=no_broker_reply, service=brokerService)
> 16:07:02: fatal:
> unable_to_resolve_or_connect_to_sclient=ES_MSGIN_RR
> 
> [qgatu003]/export/home/mxdooley/mbi_script$print $?
> 1
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at mail.pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk


__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/



More information about the Chicago-talk mailing list