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.