|There's more than one way to do things|
create a HTTP::Response object from a raw buffer?by edan (Curate)
|on Mar 30, 2003 at 11:25 UTC||Need Help??|
edan has asked for the
wisdom of the Perl Monks concerning the following question:
I have a script that makes an HTTP request directly by opening a socket and reading the response (I can't use LWP::UserAgent because the program is multi-tasking, so it can't block while waiting for the response). Okay, so now that I have the HTTP response in a buffer, I want to know what I've got there. Is there an easy way to turn it into an HTTP::Response object, so I can query some info out of it? I didn't see an appropriate method in the perldoc...
In fact, all I really need is the response code. So, if no one has a good idea of how to turn it into an HTTP::Response, perhaps you can have a look at this snippet and see if it looks okay as far as parsing the response for the code: