Mark Stosberg wrote:
In 2001, I posted on this list a suggestion for improving mode_param: http://www.mail-archive.com/cgiapp%40lists.vm.com/msg00001.html
Years ago, Jesse realized the value of passing the run mode through
"PATH_INFO". My own years of experience since then have validated this as a very functional and efficient technique.
I agree that this would be very cool to have out of the box. It would make forms easier for example, and urls in general will be more manageable.
My code has been updated a bit since then. Here's what it looks like now:
[snip]
# just grab the first field
$pi = (split q'/', $pi)[0];
I would like to see some more flexibility here: it would be cool to be able to use the first field as a session id for instance. Can we have the [0] there as a parameter? Or would you suggest otherwise?
return (length $pi) ? $pi : $self->query->param('rm');
That should probably read $self->query->param($self->mode_param());
########
I would like to again propose that support for this technique be added to CGI::App directly. It could be done by publishing "get_mode_param" as a plugin, but I think it's reasonable for inclusion in the core.
I agree. In fact, I feel that modifying mode_param to look at the PATH_INFO first can be justified by the practice: I have never encountered a situation where my scripts had a path_info without me explicitly setting it, and I've been using C::A for almost two years now in at least 5 large applications. I don't expect it would break any existing applications.
Here's what I have in mind for the API:
$self->mode_param('rm', path_info => 1);
If you do it that way, then how about taking the value for path_info as the path field to use?
Just my 2c... Rhesa
--------------------------------------------------------------------- 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]
