Does LWP::UserAgent download images

H

himanshu.garg

Hi,

Will the following code also download the images on
search.cpan.org, if any :-

require LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $response = $ua->get('http://search.cpan.org/');

If yes, is there a way to avoid them. I want to minimize the
bandwidth the program consumes.

Thank You,
Himanshu.
 
G

greymaus

Hi,

Will the following code also download the images on
search.cpan.org, if any :-

require LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $response = $ua->get('http://search.cpan.org/');

If yes, is there a way to avoid them. I want to minimize the
bandwidth the program consumes.

Thank You,
Himanshu.

Use WWW::Mechanize, a superset of LWP::UserAgent. read the docs.
 
B

Ben Morrow

Quoth (e-mail address removed):
Will the following code also download the images on
search.cpan.org, if any :-

require LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $response = $ua->get('http://search.cpan.org/');

No. LWP doesn't follow links to images, it just gets the URI you ask
for.

Ben
 
J

Jürgen Exner

Will the following code also download the images on
search.cpan.org, if any :-

It will get whatever resource you ask it to get. If you ask for an HTML page
then it will get that HTML page, if you ask for a picture then it will get
that picture. It doesn't care about the different content types.

jue
 
H

himanshu.garg

It will get whatever resource you ask it to get. If you ask for an HTML page
then it will get that HTML page, if you ask for a picture then it will get
that picture. It doesn't care about the different content types.

jue

Thanks for the replies. I don't have to worry about unnecessary image
downloads now.

Will also check WWW::Mechanize and the documentation of LWP.

Thanks,
Himanshu.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,149
Members
46,695
Latest member
StanleyDri

Latest Threads

Top