[ale] Redirecting STDOUT in perl to a socket

Geoffrey esoteric at 3times25.net
Wed May 12 07:35:13 EDT 2004


Christopher Fowler wrote:
> I've created a socket from a client usins:
> $client = $server->accept();
> 
> I'm trying to redirect 0,1,2 with the following code:
> 
> *STDIN = $client;
> *STDOUT = $client;
> *STDERR = *STDOUT;
> 
> If I stay in the perl program all output goes to the socket.
> The minute I do exec() the output goes to the TTY.  What is the correct
> way to redirect those so they follow during an exec()?

As in C, might you need to do a fork() first?  Running through perldoc 
-f exec() I don't see that it has the same functionality as 'man 3 
exec()' as perl exec() uses the shell to parse it's args.

Just a lot of guessing here as I've not played with exec() in perl (yet).

-- 
Until later, Geoffrey                     Registered Linux User #108567
Building secure systems in spite of Microsoft



More information about the Ale mailing list