Is it possible to create an empty interpreter thread?
I mean often you don't need shared variables or anything and you
have opened connections or created objects you can't/don't want to
clone. So instead of cloning the state of the current interpreter
you'd create a new empty one that would read, compile and
execute a script.
Something like:
$pid = NewThread "script.pl";
It would be nice to be able to redirect the STDIN, STDOUT and
STDERR of the thread to pipes you create :
pipe CHILDIN, TOCHILD;
pipe FROMCHILD, CHILDOUT;
$pid = NewThread "script.pl", CHILDIN, CHILDOUT, CHILDOUT;
No cloning problems, no need to destroy objects you dutifully
cloned, but do not need in the child at all etc. etc. etc.
And if the first parameter to NewThread() could be a filehandle you
could do pretty much anything :
pipe CHILDSRC, EXECINCHILD;
$pid = NewThread CHILDSRC;
print EXECINCHILD <<"*END*";
use My::Module;
download_url("$url");
*END*
close EXECINCHILD;
There is a problem (on Win32) though. You can't select(2) on a
pipe under Win32 (AFAIK). select() only works on socket()s.
I think we could work around this with Win32::Semaphore or
something like that in most cases.
Jenda
== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
: What do people think?
What, do people think? :-)
-- Larry Wall in <[EMAIL PROTECTED]>