You're correct, haj, that things should work even if 'base' is broken. So I did some more research, and here're my results:
use WWW::Mechanize::Link; $u = WWW::Mechanize::Link->new ({url=>'./page2', base=>'http://domain.com/page/'}); print $u->url_abs, "\n"; $u = WWW::Mechanize::Link->new ({url=>'../page2', base=>'http://domain.com/page/'}); print $u->url_abs, "\n"; $u = WWW::Mechanize::Link->new ({url=>'./page2', base=>'http://domain.com/page'}); print $u->url_abs, "\n"; $u = WWW::Mechanize::Link->new ({url=>'../page2', base=>'http://domain.com/page'}); print $u->url_abs, "\n";
The output is:
http://domain.com/page/page2 http://domain.com/page2 http://domain.com/page2 http://domain.com/../page2
As you can see, for links that start with ./ the base MUST NOT end with /, which for links that start with ../ the base MUST end with /. So, whether or not the <base> is honored, some links will be broken. Any cure?
In reply to Re: WWW::Mechanize doesn't respect <base>?
by Anonymous Monk
in thread WWW::Mechanize doesn't respect <base>?
by Arik123
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |