Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: WWW::Mechanize doesn't respect <base>? (patch)

by Anonymous Monk
on Apr 28, 2021 at 01:39 UTC ( #11131773=note: print w/replies, xml ) Need Help??


in reply to WWW::Mechanize doesn't respect <base>?

Here you go
--- old\lib\WWW\Mechanize.pm 2021-04-27 18:52:56.406250000 -070 +0 +++ new\lib\WWW\Mechanize.pm 2021-04-27 18:52:20.046875000 -070 +0 @@ -1435,6 +1435,7 @@ iframe => 'src', link => 'href', meta => 'content', + base => 'href', ); sub _extract_links { @@ -1512,6 +1513,9 @@ my $text; my $name; + if( $tag eq 'base' ){ + $self->{base} = $token->[1]{href} ; + } if ( $tag eq 'a' ) { $text = $parser->get_trimmed_text("/$tag"); $text = '' unless defined $text;

Replies are listed 'Best First'.
Re^2: WWW::Mechanize doesn't respect <base>? (patch)
by Arik123 (Beadle) on May 11, 2021 at 08:33 UTC

    After many experiments, I can say this patch works perfectly. Thanks!

    BTW, immediately after the call to $mech->get(), $mech->base() still gives the wrong value. It get fixed after a call to $mech->links(), which is OK for me.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2021-10-28 07:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (96 votes). Check out past polls.

    Notices?