Cees Hek wrote:
> Hi All,
>
> I started playing around with the new CA::Dispatch today for a
> project, and I am pretty happy with how it is going so far (thanks
> Michael). One of the missing pieces is a simple way of generating
> URLs based on the new CA::Dispatch dispatch table that the user sets
> up.
Yeah, that's still on the TODO list. Since I'm not sure I will use it, it's not
high on that list :)
> So I tried to tackle that one today, and have some stuff working.
> This is really just a notice to the list that I am working on this so
> that hopefully there isn't too much duplication of work. It is too
> early to publish the results, but if someone is interested in helping
> out, or trying it out, I can forward what I have on.
Please feel free to use the public svn repo. Since this plugin would be heavily
dependent on C::A::D, I think it should be bundled together.
svn://svn.cromedome.net/CGI-Application-Dispatch
> Effectively all that it will do is add a 'url' method to your base
> class. This url method can accept a list of parameters including
> 'app' and 'rm' to designate the application and runmode the URL
> requires (if the 'app' is omitted, the current application is used).
> Then the dispatch table is traversed for an entry that matches up with
> the given parameters, and a URI object is created and returned
> (complete with path_info and query parameters).
Another thing missing from Dispatch is multiple "versions" of the dispatch
table. I see needing at least the following:
+ a cached reverse look up version to more easily create URLs (no need to
create this multiple times if we don't have to).
+ a cached version of the regex mapping (each rule becomes a regex that
Dispatch uses internally. No need to create this for each rule tried on each
dispatch attempt).
+ and a cached version of URL-to-Rule mappings. If we've already seen a URL,
why should we run it through the table again? We already know which rule
matched.
Now, under normal CGI the above alternate table wouldn't be much good (except
for the reverse look up table if the plugin to create URLs is used more than
once).
--
Michael Peters
Developer
Plus Three, LP
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]