[cgiapp] C::A::P::Routes

P Kishor punk.kish at gmail.com
Thu Mar 4 09:00:37 EST 2010


On Thu, Mar 4, 2010 at 3:33 AM, Mike Tonks <fluffymike at googlemail.com> wrote:
> I am using CAP::Routes and it works very well for me.
>

Thanks for the report. This is good to know, because this proves I
must be doing something wrong, even though I can't figure out what. I
am not using ScriptAlias, but am using .htaccess with RewriteConds and
RewriteRule.

By the way, could you please check if $self->route_dbg works for you?

My one thought is -- perhaps I am not doing anything wrong, but that
it is my combination of various plugins. I recall (from a while back),
I think I had identified some clash between CAPRoutes and
CAPAuthentication, but it could be some other plug in well that seems
to redefine the runmodes.



> First off, I am using ScriptAlias to map the url and hide the script
> name it the url:
>
> So I have a few lines in my /etc/apache2/sites-available/app virtual host file:
>
>        ScriptAlias /contacts   /var/www/app/cgi-bin/contacts.cgi
>        ScriptAlias /jobs        /var/www/app/cgi-bin/jobs.cgi
>        ScriptAlias /titles       /var/www/app/cgi-bin/titles.cgi
>
>
> Then in contacts.cgi:
>
> #!/usr/bin/perl -w
>
> use strict;
>
> use App::Contacts;
>
> my $app = App::Contacts->new();
>
> $app->run();
>
> and finally the run modes in Contacts.pm
>
>
> sub setup
> {
>        my $self = shift;
>
>        $self->start_mode('view');
>
>        $self->routes_root('');
>
>        $self->routes([
>                ''                                                                      => 'view' ,
>                '/guest'                                                                => 'guest',
>                '/staff/edit/:id'                                               => 'edit_staff',
>                '/staff/process/:id'                                    => 'edit_staff_process',
>                '/:id/address/new'                                              => 'edit_address',
>                '/:id/address/:id2'                                     => 'edit_address',
>                '/:id/address/process/:id2'                     => 'edit_address_process',
>                '/:id/email/process/:id2'                               => 'edit_email_process',
>                '/:id/email/new'                                                => 'edit_email',
>                '/:id/email/:id2'                                               => 'edit_email',
>                '/:id'                                                                  => 'view' ,
>                ]);
>
> etc.
>
> Then my urls are e.g.
>
> http://mysite/contacts - default page
> http://mysite/contacts/1234 - view a specific contact record
> http://mysite/contacts/1234/address/new - add address to a contact record
>
> Note that I haven't got the /contacts/ bit in my routes_root - it
> doesn't seem to need it.
>
> I've been using this for 6 months plus now and as I say it works really well.
>
> Hope this helps.
>
> mike
>
> #####  CGI::Application community mailing list  ################
> ##                                                            ##
> ##  To unsubscribe, or change your message delivery options,  ##
> ##  visit:  http://lists.openlib.org/mailman/listinfo/cgiapp    ##
> ##                                                            ##
> ##  Web archive:   http://lists.openlib.org/pipermail/cgiapp/   ##
> ##  Wiki:          http://cgiapp.erlbaum.net/                 ##
> ##                                                            ##
> ################################################################
>
>



-- 
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
-----------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
=======================================================================


More information about the cgiapp mailing list