Click here to get back home

Does LWP::UserAgent download images

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Does LWP::UserAgent download images himanshu.garg 03-04-2008
Posted by himanshu.garg on March 4, 2008, 5:15 am
Please log in for more thread options
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.


Posted by Ben Morrow on March 4, 2008, 6:26 am
Please log in for more thread options

Quoth himanshu.garg@gmail.com:
>
> 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


Posted by Jürgen Exner on March 4, 2008, 9:19 am
Please log in for more thread options
himanshu.garg@gmail.com wrote:
> 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

Posted by himanshu.garg on March 5, 2008, 1:23 am
Please log in for more thread options
> himanshu.g...@gmail.com wrote:
> > Will the following code alsodownloadthe images on
> >search.cpan.org, if any :-
>
> It will get whatever resource you ask it to get. If you ask for an HTML pa=
ge
> 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.

Similar ThreadsPosted
Download a HTML page with images? April 25, 2005, 8:24 am
Resuming a download (or partial download) July 16, 2005, 9:36 pm
How to join two png images in one ? November 15, 2005, 1:20 am
Images and PDF::API2 January 10, 2006, 7:56 pm
Creating Images October 17, 2007, 2:06 pm
Resizing JPG images with Perl? August 25, 2004, 4:21 pm
Help: making images with perl? November 27, 2004, 7:29 am
manipulating JPEG images March 14, 2006, 10:07 pm
WWW::Mechanize : Is immediate caching of images possible? January 4, 2008, 5:12 pm
Displaying 12 images from dir with option to view next 12 etc September 12, 2005, 7:24 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap