Re: POE and perl fork interaction

[email protected]
Newsgroups gmane.comp.lang.perl.poe
Message-ID <[email protected]>



 This got me to thinking....

Setup a POE::Wheel::Followtail for each? file you want to tail.? No need to spawn off other processes.

If you DO need separate processes, from the main process run a POE::Wheel::Run and start another kernel on that process.? Setup a Followtail wheel for the input and handle the output back to the Main code via STDOUT and the Run object.

I tend to use fork sparingly and if you need to do alot of things simultaneously, you should probably handle those in POE first.

HTH,

Dougie!!!


 

-----Original Message-----
From: Robert Landrum <[email protected]>
To: Deven Parekh <[email protected]>
Cc: [email protected]
Sent: Tue, 13 Jan 2009 6:51 pm
Subject: Re: POE and perl fork interaction









It's not clear what you're trying to do, but I suspect that you're doing 
it wrong.  :(?
?

Is there a reason why you don't use POE::Wheel::Run to tail the files??
?

There's also:?
?

http://search.cpan.org/~rcaputo/POE-1.003/lib/POE/Wheel/FollowTail.pm?
?

I suspect that your forked tail process may have events queued from the 
parent, as outlined in POE::Wheel::Run section on Nested POE Kernels.?
?

Good luck.?
?

Rob?
?


Deven Parekh wrote:?

> Hello,?

>?

> Is it possible to use POE and the fork function in the same script.?

> I am running into an interaction problem where the POE::Kernel does not?

> return if i have forked off other process outside of the POE. Any input on?

> what I may be doing wrong?

>?

> Here is the psuedo code logic of my script?

>?

> #--- Call a function to fork off a process to start tailing some files?

> #--- store its the above pids so we can terminate later?

>?

> #--- Call POE::Wheel::Run to do some task?

>?

> #--- After the above POE task returns kill the tailing process?

>?

>?

> If i do not do the forking for tailing files, the POE::Kernel returns after?

> the?

> task is completed, but if I fork of the tailing process as above,?

> the POE::Kernel never returns.?

>?

> Any input will be appreciated.?

>?

> Thanks in advance.?

>?

> BR?

>   DP?

> p.s: I thought i had read about this interaction somewhere in documentation?

> but am not?

>       able toget to it to follow discussion around it, if any.?

>?

>   ?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.