John W. Krahn wrote:
> Meir Yanovich wrote:
>>
>> in new to perl .
>> i know how to pass simple variables to perl subs
>> but now i like to pass HTTP::Response variable to sub
>> and im getting errors here is my example :
>>
>> my $browser = LWP::UserAgent->new();
>> my $response = $browser->get($url);
> 
> $response now contains the data from the web site at $url.  It is *NOT* 
> an object but an HTML page.

It is true that the get function from LWP::Simple returns the URL content, but
the get method from a full-blown LWP::UserAgent object returns an HTTP::Response
object, with the content in $response->content.

>> &get_response($response);
>> #the sub
>> sub get_response {
>> my $ res = shift;
>> print $res->status_line;
> 
> You are trying to use the HTML data as an object here which makes no sense.
> 
>> }
>>
>>
>> the error im getting is :
>> Can't call method "status_line" on unblessed reference at

It looks ok to me and works on my system. Please would you post the full 
program?

Rob


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to