in reply to Returning a bad status back to the parent UNIX process

Is there a way to pass this out to unix as a bad status

Use exit:

$ perl -e'exit 42'; echo $? 42
and retain the parsing errors generated in my example?

I don't understand this. Aren't errors being written to the ksh log? If you mean to retain the errors within the program, there's no much point in that since if you exit, the program will not be running anymore :^).

--
David Serrano

Replies are listed 'Best First'.
Re^2: Returning a bad status back to the parent UNIX process
by JimRobinson (Initiate) on Jul 27, 2006 at 12:55 UTC
    Thanks David, I would like to hold on the the errors so I'll know what to fix but in my case the xls file is being written out, less the bad records and the unix script doesn't know there is a problem. In my unix scipt I am call the perl scipt using return $? but the status seems to be coming back as a 0 value.

      $? is only useful if you're spawning other processes from Perl, using system, open and others. So if you're not doing this, it's very possible that you're indeed returning a 0 to the calling script. Why don't you return a simple 1 and let the calling script manage the error condition? Better try to post some code for making your problem a bit clearer.

      --
      David Serrano

      I'm not following 100% (more code would be useful). But I think you should print errors to STDERR and in your calling script (or cmdline invoke), redirect STDOUT and STDERR to different files.

      -derby