Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: executing external program question

by odrm (Novice)
on Jun 19, 2007 at 15:33 UTC ( #622039=note: print w/replies, xml ) Need Help??


in reply to executing external program question

Two rather different approaches spring to mind:
  1. Save the output from the long-running job to a temporary file, and read from that when you need the results
  2. Launch the long-running job as a sub-process of your Perl program, and use one of the many IPC (inter-process-communication) methods
Alternative (a) is a lot easier to implement provided that you can run the 1hr+ job before the rest of the code. Data::Dumper or Storable are two useful modules if you want a "perlish" format to the results data. Alternative (b) may allow you to interact with the long-running job, but it is non-trivial to avoid all of the potential pit-falls of concurrent programming. You may want to investigate the IPC::Open2 module for this alternative.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://622039]
help
Chatterbox?
[thezip]: oops... My mind is backwards (this works): find . -mindepth 2 -name "*.csv" | xargs wc -l

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (12)
As of 2016-12-06 18:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (113 votes). Check out past polls.