Todd Chester has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

Is there a way to get LWP::UserAgent to follow links as does `curl -L`?

Replies are listed 'Best First'.
Re: can LWP::UserAgent follow links?
by huck (Prior) on Jul 29, 2017 at 02:11 UTC
      I was just on the perl chat line. One of the developers uncovered the issue I was having. The default is 7 redirects. I cough on two because tcp dump truncates the return string (it is long).

      They said they would look at it and see if they could fix it and then eMail me.

      Is this something worth posting back?

        It is nice when someone posts about the resolution of a bug

Re: can LWP::UserAgent follow links?
by Anonymous Monk on Jul 29, 2017 at 02:02 UTC

    Hi,

    LWP::UserAgent is not like "bin/curl", its more like libcurl, does that explain the difference?

      Perl6's libcurl has this:
      my $curl = LibCurl::Easy.new(:verbose, :followlocation, URL => 'http://example.com'); $curl.setopt(:verbose, followlocation => 1);


      I was wanting a way to do `followlocation` with p5's LWP::UserAgent

        FWIW

        redirect/location (HTTP) is not the same as a link (html)