Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^11: Need help with WWW::Mechanize and Chrome cookies

by bakiperl (Beadle)
on Jul 11, 2021 at 14:42 UTC ( [id://11134915]=note: print w/replies, xml ) Need Help??

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.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11134915]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-06-20 19:46 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.