Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Parsing data from a data feed

by Apterigo (Scribe)
on Jul 19, 2001 at 00:33 UTC ( #97879=note: print w/replies, xml ) Need Help??


in reply to Parsing data from a data feed

Well, this is what i had to change it to, now it works perfect:
do { $socket->recv($response, 1); $data = $data . response; } until ($response eq "\0x00");
As far as the rest is concerned, I cannot read using getline I think, and I cannot read til EOF because there is no EOF, as I said the datafeed goes on forever. You may be right though, I'll check into that.
Thanks Tons!
Apterigo

Replies are listed 'Best First'.
Re: Re: Parsing data from a data feed
by bikeNomad (Priest) on Jul 19, 2001 at 01:18 UTC
    I don't know why getline wouldn't return a record at a time if you set $/ to "\x00". The advantage of doing it this way is that you should burn less CPU time, because the low-level (C) code is actually handling the incoming characters and you get full records. Generally, the less times you can manage to go through a loop, the better. So your get-a-record routine would be just:

    my $response; { local $/ = chr(0); # or "\x00" $response = $socket->getline }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2022-08-18 20:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?