Should URL be split up? (was Re: Perl 5 Classes for the Web (CGI and

Martijn Koster (m.koster@nexor.co.uk)
Thu, 16 Mar 1995 09:30:17 +0000


Tim wrote:

> On the UR* side, I've been tempted to discuss URI/URN/URL issues
> and class names etc but I think we'll get a lot of mileage out of
> the URL class that Martijn Koster is working on.

I think so too, but Graham has a good point about adding schemes.
Even with the autloading of tranport classes I mentioned before,
you're still stuck because you need to modify URL.pm to support the
new URL scheme.

Regarding this, Graham wrote:

> Each package is responsible for parsing its own url as there is no generic
> format for a url (eq mailto:bodg@tiuk.ti.com and http://....). Each package
> ,for the same reasons, is also responsible for stringifying the url.

and Roy replied:

> Hmmmmm...I'll contest that.  It is okay (in fact, necessary) to have
> a generic URL parser -- the schemes just have to know how to
> stringify the appropriate parts prior to a request.  BTW, where do
> you put the resolver for relative -> absolute URLs?

I was wondering if not some compromise is possible.

Grahams classes do both URL's and transport. However, you might want
to use URL without the transport (say when proxying). So what about
splitting the two, and restructuring the URL class into an
auto-loading/auto-registering set of classes. They can all inherit a
generic parser, but it would allow easier additions, and mean entries
%URL::DefPort, %URL::InSet could be put in their specific classes.

By keeping it separate from the transport, we can tackle those issues
separately; instead of isA replationships with URL schemes they become
uses relationships.

Comments?

-- Martijn
__________
Internet: m.koster@nexor.co.uk
X-400: C=GB; A= ; P=Nexor; O=Nexor; S=koster; I=M
X-500: c=GB@o=NEXOR Ltd@cn=Martijn Koster
WWW: http://web.nexor.co.uk/mak/mak.html