Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Parsing data from a data feed

by Apterigo (Scribe)
on Jul 19, 2001 at 00:33 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (8)
As of 2024-04-25 11:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found