Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: Running a process in the background

by tstock (Curate)
on Nov 23, 2004 at 22:29 UTC ( #410005=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Running a process in the background
in thread Running a process in the background

if (my $pid = fork) { # parent ($pid is process id of child) parent_function(); } else { # child child_function(); exit; }
Feel free to read perldoc -f fork, and look at some examples online. This is not really advanced perl, but it requires some attention.


Comment on Re^3: Running a process in the background
Download Code
Re^4: Running a process in the background
by thor (Priest) on Nov 23, 2004 at 22:39 UTC
    From personal experience, the exit is key. Let's just say that I'm glad that I had my own Sun workstation when I started experimenting with fork...*cough*fork bomb*cough*

    thor

    Feel the white light, the light within
    Be your own disciple, fan the sparks of will
    For all of us waiting, your kingdom will come

Re^4: Running a process in the background
by binary (Novice) on Nov 23, 2004 at 23:05 UTC
    Hello, Remember to check for a fork error after forking:
    if (my $pid = fork) { ## Parent } elsif ($pid == 0) { ## Child } else { ## Error, $pid is undefined }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (11)
As of 2014-04-24 09:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (565 votes), past polls