On Tue, 18 Jul 2006 15:12:10 -0700 Eric Wilhelm <[EMAIL PROTECTED]> wrote:
> You probably want to avoid doing it the "incorrect" (even if only
> slightly-so) way. The fact that a kernel or other environment issue
> could break it is enough reason.
Agreed.
> Have you considered doing something with tempfiles or external
> programs? Maybe even mocking-up the network instead of using the real
> socketpair? IPC::Run, IPC::Open3 or something?
Well, a tempfile won't really help me here. The function will write into
a handle, then expect a reply back from another handle. I suppose I could
have a big collection of little files containing all the canned
responses, and keep making a new tempfile to write the query into, and
checking that on return.. But that's starting to sound quite a big system
in itself.
IPC::Open2 could be done - I use that internally in the module anyway for
its "real" work so that doesn't bring in another dependency.. I'm not
sure what it would add though... Maybe something of:
open2( $rd, $wr, "perl", "-e",
q{<> eq "I want this request\n" or exit(1);
print "And then I send this response\n" } );
Then read and write the handles, and check the child's exit status... I
suppose that could be done.. but if I'm doing that, it almost seems just
as easy to pipe()/fork() myself anyway. Keeps all the code in the file
itself then, rather than in strings.
--
Paul "LeoNerd" Evans
[EMAIL PROTECTED]
ICQ# 4135350 | Registered Linux# 179460
http://www.leonerd.org.uk/
signature.asc
Description: PGP signature
