Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Re: IO::Socket::UNIX close() discards data when called "too soon"?

by Anonymous Monk
on Jan 20, 2004 at 15:05 UTC ( #322598=note: print w/replies, xml ) Need Help??


in reply to Re: IO::Socket::UNIX close() discards data when called "too soon"?
in thread IO::Socket::UNIX close() discards data when called "too soon"?

It should read all the lines, as the readline brackets are in a list assignment - it only returns the first line though. The program works fine here, perl 5.8.2 on linux 2.4.21
  • Comment on Re: Re: IO::Socket::UNIX close() discards data when called "too soon"?

Replies are listed 'Best First'.
Re: Re: Re: IO::Socket::UNIX close() discards data when called "too soon"?
by pfaut (Priest) on Jan 20, 2004 at 15:15 UTC

    The server reads from the client with the following line in do_something():

    my ($l) = <$fh>;

    That is not a list assignment. If you want to read all of the data from the client, try adding local $/ = undef; before the above line.

    90% of every Perl application is already written.
    dragonchild
      perl -MO=Concise,-exec -e 'my ($l) = <$fh>' 1 <0> enter 2 <;> nextstate(main 1 -e:1) v 3 <0> pushmark s 4 <#> gvsv[*fh] s 5 <1> readline[t3] lK*/1 6 <0> pushmark s 7 <0> padsv[$l:1,2] lPRM*/LVINTRO 8 <2> aassign[t4] vKS 9 <@> leave[1 ref] vKP/REFC perl -MOpcode -le 'print Opcode::opdesc("aassign")' list assignment

      It was the uncaught SIGPIPE. Adding undef $/; to client solved the problem. Thanks!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2020-11-26 08:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?