in reply to Re^10: Need help with WWW::Mechanize and Chrome cookies
in thread Need help with WWW::Mechanize and Chrome cookies

I sent you the url.

The error occurs on both of these calls:
$mech->get($foo, ':content_file'=>$filename); my $file_content = $mech->get($foo);

Replies are listed 'Best First'.
Re^12: Need help with WWW::Mechanize and Chrome cookies
by Corion (Patriarch) on Jul 11, 2021 at 15:10 UTC

    Yes. So what is the value of $foo? Did you print it? Is the loop necessary for the bug to happen, or does the error happen with the hardcoded value for $foo as well?

    From the URL you sent to me, it seems that WWW::Mechanize returns absolute URLs, while WWW::Mechanize::Chrome returns whatever URLs are contained in the file. Simple printing of the values can confirm that to you.

    Until WWW::Mechanize::Chrome achieves API parity with WWW::Mechanize in that part, consider converting the URL to absolute yourself.

      I modified the code to eliminate the loop and I changed the URL to absolute.
      my @urls = map { $_->url_abs } @links;
      The error message went away but these calls still don't return anything.
      $mech->get($foo, ':content_file'=>$filename); my $file_content = $mech->get($foo);

        Why do you expect the following to work for WWW::Mechanize::Chrome? This is not a documented call:

        $mech->get($foo, ':content_file'=>$filename);

        I wonder why you say that the following "return anything":

        my $file_content = $mech->get($foo);

        ->get() is documented to return a response, so I suggest that you print it, or inspect it using Data::Dumper.