Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

2 programs as 2 processes

by Anonymous Monk
on Sep 22, 2000 at 22:15 UTC ( #33671=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi. Is it possibly in Perl to EXECUTE 2 PROGRAMS from ONE in that way, that the 2 programs were working at the same time - 2 PROCESSES ??? I made Perl program: system("c:\\valeriy\\program2\\pr1.pl"); system("c:\\valeriy\\program2\\pr2.pl"); But It executes FIRST, then WAITS, than executes 2ND. I need then working at the same time, paralelly. :) Hope here are Perl professionals.

Replies are listed 'Best First'.
(bbq) Re: 2 programs as 2 processes
by BBQ (Deacon) on Sep 22, 2000 at 22:36 UTC
    use the fork, Luke...

    #!/home/bbq/bin/perl
    # Trust no1!

      Note that the originaly poster appears to be using a Microsoft "operating system" which means that fork probably isn't the best choice. This is because prior to Perl 5.6.0, fork() didn't work. With Perl 5.6.0, fork() might work for this but it is very new and appears to be quite buggy in some situations.

      Personally I'd use system(1,"script") to prevent the calling script from waiting.

              - tye (but my friends call me "Tye")
Re (tilly) 1: 2 programs as 2 processes
by tilly (Archbishop) on Sep 22, 2000 at 22:32 UTC
Re: 2 programs as 2 processes
by jreades (Friar) on Sep 22, 2000 at 22:30 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://33671]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2023-02-03 13:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (26 votes). Check out past polls.

    Notices?