Does LWP::UserAgent download images

Discussion in 'Perl Misc' started by himanshu.garg@gmail.com, Mar 4, 2008.

  1. Guest

    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.
     
    , Mar 4, 2008
    #1
    1. Advertising

  2. greymaus Guest

    On 2008-03-04, <> wrote:
    > 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.


    --
    greymaus
    Just Another Grumpy Old Man
     
    greymaus, Mar 4, 2008
    #2
    1. Advertising

  3. Ben Morrow Guest

    Quoth :
    >
    > 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
     
    Ben Morrow, Mar 4, 2008
    #3
  4. 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
     
    Jürgen Exner, Mar 4, 2008
    #4
  5. Guest

    On Mar 4, 7:19 pm, Jürgen Exner <> wrote:
    > 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 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.
     
    , Mar 5, 2008
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. La Jesus
    Replies:
    9
    Views:
    1,347
    Gunnar Hjalmarsson
    Oct 27, 2003
  2. Chandra

    Problem with LWP::USERAGENT

    Chandra, Feb 25, 2004, in forum: Perl
    Replies:
    0
    Views:
    515
    Chandra
    Feb 25, 2004
  3. Vinay Gupta
    Replies:
    2
    Views:
    1,127
    Michael Schlenker
    Jul 27, 2004
  4. Playker
    Replies:
    0
    Views:
    518
    Playker
    Feb 24, 2005
  5. Alex
    Replies:
    0
    Views:
    221
Loading...

Share This Page