Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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...

In reply to Re: (Seemingly) Broken interactions between Net::Server and IO::Pipe? by bmcatt
in thread (Seemingly) Broken interactions between Net::Server and IO::Pipe? by bmcatt

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2022-05-29 04:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (101 votes). Check out past polls.

    Notices?