Re: URI::URL::rel difficulty
Gisle Aas (gisle@aas.no)
10 Jan 1998 13:00:54 +0100
James Garrison <jhg@austx.tandem.com> writes:
> package URI::URL;
> $VERSION = "4.13"; # $Date: 1997/12/12 09:54:32 $
>
> I'm trying to write a script to clean up
> a web hierarchy that was coded using all
> absolute URLs. I run into problems because
> when URI::URL::rel is executed, it does
> not correctly (IMHO) handle cases where
> the given URL diverges from the base at
> the root. For example:
>
> $BASE = http://host.domain.com/aaa/bbb/ccc/
> $URL1 = http://host.domain.com/aaa/bbb/ddd/xx.html
> $URL2 = http://host.domain.com/xxx/yyy/zzz/ww.html
>
> $URL1->rel($BASE) produces ../ddd/xx.html (correct)
>
> However,
>
> $URL2->rel($BASE) gives ../../../xxx/yyy/zzz/ww.html
>
> instead of the more logical /xxx/yyy/zzz/ww.html
>
> What do you think?
I think rel() does the right thing. It should give you an relative
link, shouldn't it?
Perhaps we should add a $URL->shortest_possible method that just tries
to minimize the length of the URL. I'll consider it if somebody
provide an implementation.
Regards,
Gisle