Subject: | |
From: | |
Reply To: | |
Date: | Wed, 10 Oct 2001 13:43:48 -0400 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Mark and I have been discussing this offline and here's the result:
----- Forwarded message from Mark Bixby <[log in to unmask]> -----
> Ted Ashton wrote:
> >
> > It seems that Perl should be able to do that same dup2() trick. After all,
> > calling open() with ">&" is supposed to call dup2. The problem is that I'm
> > not completely clear about what to duplicate, as it definitely isn't happy
> > with open(STDOUT,">&STDIN") (and I'm not sure that it should be :-).
>
> Oooh, excellent challenge! ;-) I hacked around for over a hour and came up
> with the following that will work under inetd and read a line from the socket
> via STDIN and then echo it back to the socket via STDOUT:
>
> #!/PERL/PUB/perl -w
>
> use POSIX;
>
> print STDERR "This is Perl on STDERR!\n";
> select(STDOUT); $| = 1;
> print STDOUT "This is Perl on STDOUT!\n";
>
> POSIX::dup2(0,1);
>
> $data = <STDIN>;
>
> printf STDOUT "data=[%s]\n",$data;
>
> The first two print statements will show up on the JINETD $STDLIST, but the
> printf statement is successfully redirected back to the network socket.
>
> Can you verify that this works on your own machine and then post the results
> back to HP3000-L? I need to get back to working on sendmail...
----- End forwarded message -----
I can confirm the results. Thanks, Mark!
Ted
--
Ted Ashton ([log in to unmask]) | From the Tom Swifty collection:
Southern Adventist University | "So just what kind of show can this troupe
Deep thought to be found at | 'The Humpty Dumpties' put on?" asked Tom
http://www.southern.edu/~ashted | exactingly.
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|
|
|