Pine Yan am Freitag, 18. November 2005 03.14:
> I did try the following:
>
> use LWP::UserAgent;
> require LWP::UserAgent;
>
> and they don't help. Since the LWP::UserAgent->new routine is working, I
> assume
> the package is loaded...

Yes it is, one can verify that by
chomsky ~ $ perl -le 'use LWP; print join "\n", grep /LWP/, keys %INC;'
LWP/MemberMixin.pm
LWP/UserAgent.pm
LWP.pm
LWP/Debug.pm
LWP/Protocol.pm

I ran your code

> > #!/home/gnu/bin/perl
> >
> > use LWP;
> >
> > my $browser = LWP::UserAgent->new;
> >
> > my $url = 'http://www.google.com';
> >
> > my $response = $browser->get($url);
> >die "Can't get $url -- ", $response->status_line unless
> >$response->is_success;

> >print "Content: $response->content_type";
> >print "--->\n$response->decoded_content";

and got (without errors):

Content: HTTP::Response=HASH(0x8410c58)->content_type--->
HTTP::Response=HASH(0x8410c58)->decoded_content

As you can see, your output statement won't print what you expect. 
Something like "$response->content_type" is not interpolated as a whole.

One way would be:

print "Content: 
@{[ $response->content_type ]}--->[EMAIL PROTECTED] $response->decoded_content 
]}";


But I haven't the answer to your question... I can just guess that there is 
some version mismatch with your perl/modules.

Maybe you could try to upgrade to perl-5.8.x and upgrade your modules too.

(btw: There is no $response->decoded_content method, at least in my 
installation)

hth, 

joe

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


Reply via email to