So I'm looking at POE::Wheel::Run because I have some operations to perform
asynchronously which may block for long periods. I don't like creating a
separate file to hold the code to do this just to satisfy the requirements
of the Program parameter of PWR's new(), though. So I'm thinking along the
lines of:
# Exec the program depending on its form.
if (ref($program) eq 'ARRAY') {
exec(@$program) or die "can't exec (@$program) in child pid $$: $!";
}
+ elsif (ref($program) eq 'CODE') {
+ $program->(); # Figure out a way to pass args
+ exit;
+ }
else {
exec($program) or die "can't exec ($program) in child pid $$: $!";
}
so I can just say
POE::Wheel::Run->new(..., Program => sub { ... }, ...);
Not a real patch since I'm just floating an incomplete idea here. I don't
know nearly enough about the guts of POE to know whether this is feasible;
what about all the fds the parent is selecting on, what does the child do
with those, etc. What are the potential pitfalls?
Yes, I could put the code in a string and just exec perl and print this to
it. But this looks cooler.
--
Peter Scott
Pacific Systems Design Technologies