-- Your Name <[EMAIL PROTECTED]> wrote
(on Friday, 23 July 2004, 06:52 AM -0700):
> First, is there any easy way to change the URI
> parsing, so that instead of going to
> http://www.mysite.com/myapp.cgi?table=album&id=5
> with a hidden run-mode of "view", you could go to
> http://www.mysite.com/myapp/album/view/5 ?
The PATH_INFO environment variable will be your friend here. What you'll
need to do is either in your mod_perl handler or the cgiapp_prerun()
method of your CGI::App is to grab the contents of the PATH_INFO env
variable and then set param()s accordingly. Your run modes will then
look for the contents of these parameters.
Let's say 'album' is your application instance script. PATH_INFO will
then contain the value '/view/5'. You could then parse it
something like this:
if ($path_info =~ m:/([a-zA-Z]*)/(\d+)/:) {
$run_mode = $1;
$record_id = $2;
}
If you're doing this in your mod_perl handler, you might then set the
appropriate GET or POST environment variable with this information. If
doing it in your cgiapp_prerun(), you could then follow with something
like:
$self->prerun_mode($run_mode);
$self->param('record_id', $record_id);
--
Matthew Weier O'Phinney
http://weierophinney.net/matthew/
---------------------------------------------------------------------
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]