Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: (Seemingly) Broken interactions between Net::Server and IO::Pipe?

by bmcatt (Friar)
on Mar 07, 2006 at 14:38 UTC ( #534926=note: print w/replies, xml ) Need Help??

in reply to (Seemingly) Broken interactions between Net::Server and IO::Pipe?

Slimmed down my code to an (obvious) test case... which (thankfully) fails.
#!/usr/bin/perl -w # server package Server; use strict; use base qw(Net::Server::Fork); my $server = bless { server => { port => 8097, log_level => 4, }, }, 'Server'; $server->run(); exit; sub process_request { my $self = shift; my $x = Feeder->new(); my $line = $x->get_line(); print "Line = $line\n"; } package Feeder; use strict; use IO::Pipe; sub new { my $class = shift; my $pipe = IO::Pipe->new(); $pipe->reader('cat', '/home/ben/foo/client'); my $self = { PIPE => $pipe, }; return bless $self, $class; } sub get_line { my $self = shift; my $fh = $self->{PIPE}; return scalar(<$fh>); }
And, the corresponding client,
#!/usr/bin/perl -w # client use strict; use IO::Socket::INET; my $sock = IO::Socket::INET->new(PeerHost => 'localhost', PeerPort => 8097, Proto => 'tcp', ); die "Unable to connect" unless $sock->connected(); while (<$sock>) { print "Got: >$_<\n"; }
I can't see that there's anything wrong with any of the above, although I'd love to be convinced otherwise...

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://534926]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2022-01-21 00:11 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (57 votes). Check out past polls.