Hi all,
I am building a nice little app with CGI::Application, and its going
swimmingly. Very straight forward and just kind of works without
having to mess around with things.
I enabled the path_info param with:
$self->mode_param( path_info=> 1 );
So my application will switch modes based on the path_info, for
example 'http://<blah>/myapp.cgi/home' goes to the home page, 'http://
<blah>/myapp.cgi/profile' goes to the profile page, etc.
I wanted to make 'http://<blah>/myapp.cgi/admin/something' to go to a
mode called 'admin/something' but of course this doesn't work, so I
added in a hack to support it in cgiapp_prerun:
if (defined($ENV{PATH_INFO})) {
if (substr($ENV{PATH_INFO}, 1, 6) eq "admin/") {
$self->prerun_mode(substr($ENV{PATH_INFO}, 1));
}
}
There is more checking than that, but thats basically what it is
doing. It seems to work great, and even HTML::Template seems to find
its templates just fine in the templates/admin/ directory. But I'm
unsure.
Is there any danger to doing this?
Is there a better way?
Would appreciate any advice people care to give on this.
Cheers,
Nathan.
---------------------------------------------------------------------
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]