Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: CSH script that calls a perl script

by hippo (Canon)
on Oct 16, 2012 at 22:07 UTC ( #999434=note: print w/replies, xml ) Need Help??

in reply to CSH script that calls a perl script

No, there is no way for a called (forked or spawned) program to export values back up the calling chain. You have only two options for passing any sort of data back up the chain. The first is the return value, but you really ought not to use that for arbitrary data values. Its use is so ingrained as a status flag for the completion of the child that to use it for anything else would just cause confusion and other problems in the long term. So, instead you might want to use the second option which is IPC or general I/O, neither of which I'm guessing is trivial in csh.

Which brings me neatly to the next point. You have read csh programming considered harmful haven't you? It's over 15 years old now and is as true today as it was back then. I would therefore humbly suggest that you would be much better off in both the short term and the long term if you were to bite the bullet and rewrite your csh script as perl for all the reasons mentioned in Tom's paper as well as to make the passing of data between your pieces of perl code so much simpler.

Of course, that's probably not what you wanted to hear.

  • Comment on Re: CSH script that calls a perl script

Replies are listed 'Best First'.
Re^2: CSH script that calls a perl script
by mark4444az (Sexton) on Oct 16, 2012 at 22:19 UTC
    Both no's on your questions I'm afraid. Actually, if I could evaluate a return value as a 1 or 0 I think that would work. That way I could shut the action down from the csh. I'm not sure how exactly to accomplish that but I think that would get me through my current dilemma. I tried using perl only and I may not have time to do that. The main problem there is that it produces a log file from another exe and so far perl does not seem to be working for that.

      Would you be happy with your Perl script returning 0 for success and 255 for failure? If so, take note...

      $ perl -e'die'; echo "GOT $?" Died at -e line 1. GOT 255 $ perl -e'exit'; echo "GOT $?" GOT 0
      perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://999434]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2019-04-22 00:04 GMT
Find Nodes?
    Voting Booth?
    I am most likely to install a new module from CPAN if:

    Results (111 votes). Check out past polls.