Arik123 has asked for the wisdom of the Perl Monks concerning the following question:
I do something like
$mech = new WWW::Mechanize; $mech->get("http://domain.com/page"); print $mech->base;
It prints 'http://domain.com/page' although the page contains the line <base href="http://domain.com/">. As a result, all the (relative) links are broken:
for ($mech->links) { print $_->url_abs, "\n"; }
prints things like "http://domain.com/page/page2" instead of "http://domain.com/page2"
Any way to fix it, without the need to regex the page myself for the Base tag?
Thanks!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: WWW::Mechanize doesn't respect <base>?
by Corion (Patriarch) on Apr 26, 2021 at 09:09 UTC | |
Re: WWW::Mechanize doesn't respect <base>?
by haj (Vicar) on Apr 26, 2021 at 10:24 UTC | |
Re: WWW::Mechanize doesn't respect <base>? (patch)
by Anonymous Monk on Apr 28, 2021 at 01:39 UTC | |
by Arik123 (Beadle) on May 11, 2021 at 08:33 UTC | |
Re: WWW::Mechanize doesn't respect <base>?
by Anonymous Monk on May 04, 2021 at 08:30 UTC | |
by haj (Vicar) on May 04, 2021 at 11:23 UTC |
Back to
Seekers of Perl Wisdom