Hello all,
Here are some proposed changes to CGI::Application::Dispatch that I want to get
into the open since there seem to be several users of it. All of these changes
are backwards compatible, but still deserver discussion:
1) Wild-card matching. This was implemented by ssoriche (hide). It will allow
rules like so:
'/post/list/*' => { '*' => 'post_list_filter' }
And you can access what was left over in $self->param('post_list_filter');
2) Remove the URL caching. Right now when Dispatch sees a URL it has mapped
before it just retrieves the resulting args from the cache and then runs that.
This starting to cause problems under FCGI because the CGI object was being
cached between requests. It also causes problems because it means that your
args_to_new (or any resulting args in a rule) have to be static. It also
increases memory usage and only really helps in a limited number of cases. So
I'm labeling it premature-optimization and dropping it. If performance problems
creep up, then there are other things we can do. But if a few dozen regexes is
causing noticeable slowdown in your application, then I'd be impressed.
3) REST features. Most of these are detailed in another thread, but it would
essentially allow you to use the value of the HTTP method when choosing which
method to dispatch to.
This will be controlled by an argument 'auto_rest' which defaults to false and
can be overridden on a per-rule basis. It will convert any rm into
rm_HTTPMETHOD. So a GET for 'foo' would become 'foo_GET'. You would of course be
able to make that 'foo_get' as well ('auto_rest_lc'?).
If you need to be more specific in your HTTP method mapping then you can add the
method to the rule inside of square brackets at the end of the rule:
':app/foo[delete]' => { rm => 'delete_foo' }
--
Michael Peters
Developer
Plus Three, LP
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.