Update: Added words in emphasis to the above para. Without them the sentence didn't make any sense.
Here is the background --
I have a reasonably mainstream application made with CGI::Application and a sprinkling of Plugins (DBH, Session, LogDispatch, AutoRunmode).
I follow the usual pattern --
package Myapp; use base 'CGI::Application'; use CGI::Application::Plugin::* sub view : StartRunmode {} sub edit : Runmode {} sub update : Runmode {} sub create : Runmode {} sub save : Runmode {} sub find : Runmode {} .. bunch of supporting subs .. sub setup {} sub cgiapp_get_query { .. require CGI::Simple; } sub cgiapp_init { }
Everything works, and now I want to clean up my URLs. Nothing fancy, just the usual stuff like so --
<server> --> <server>/index.cgi <server>/ --> <server>/index.cgi <server>/Item --> <server>/index.cgi?rm=view&id=Item <server>/(view|edit|create)/Item --> <server>/index.cgi?rm=$1&id=Item <server>/find/?q=search_term --> <server>/index.cgi?rm=find&q=search_t +erm
calls to "update" and "save" will be via POST, so they should be let in freely, and the same applies to all static content such as css, js, media, etc.
So, I started with mod_rewrite voodoo, but after 4 days of tackling it unsuccessfully, I have given up on it.
Even if I get everything working well with mod_rewrite, I am actually loathe to implement it, because in the long run, I want to do minimum amount of messing with Apache configs, something I may not have complete control over in different conditions. Keep in mind, I don't mind implement a couple of mod_rewrite rules, but doing it in my application will give me more control for future development and modification.
So, I started looking for alternatives, and found CGI::Application::Dispatch. Except, I can't, for the life of me, figure out how to graft in C::A::D into my existing application.
If I am being dense, just whack me on your head with your esc key. In any case, do guide me through this valley of confusion.
Once I figure it all out, I will write up a nice easy tutorial that even PHP folks will be able to understand. Promise.
Update: and, yes, I have looked at all the CGI::App::Dispatch articles that I could find. While they do explain stuff, they don't explain it in context of implementing CAD within and existing CGI::App application. At least, not in the way I could understand.
Update2: and, I need to do with vanilla cgi first, before I attempt all the CAD magic with mod_perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |