So I've started fiddling with Net::Server, and so far so good. I no longer need to write all of this accept/fork/wait for child type routines. I also gave the author some comments, and I think a couple of them actually went into the newer version.
Now I have a problem , though. The way I'd like to use this is so that my server which extends Net::Server receives requests, and then forks off a child that performs certain tasks.
One of the underlying packages ( an in-house thing ) is a sort of a rsh-type thing which works _very_ well. you can run arbitrary commands anywhere, and you get to control logs, input, output. Think of it as a Telnet.pm on steroids. ( the only drawback being that it was written for perl4 / early perl5 )
So when I fork from the Net::Server subclass, I want to use this package to talk to other machines. However, it seems to be confused about where to read from or write to, presumably because Net::Server does some funky things with these handles... As far as I could tell, it switches STDOUT and STDERR with the equivalent of the incoming sockets, and STDERR points to STDOUT. I thought that dup'ing these handles before hand and restoring them after forking would fix the problem, but apparently not.
The underlying package seems to be forking as well, and creates a pipe to the ( possibly ) remote process' std(out|err|in).. it's somehow getting very confused there, I think
At this point I don't even know if I'm going about the correct way... Can anybody tell me how to set all of these std(out|err|in) related settings to the 'default' state, as in when the script was invoked without Net::Server?
In reply to Restoring std(outerrin) with Net::Server by lestrrat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |