[cgiapp] Re: Dispatching both 'login' and 'login/*' to the same app?

Clayton Scott clayton.scott at gmail.com
Tue Feb 24 18:27:08 EST 2009


On Tue, Feb 24, 2009 at 11:56 AM, Clayton Scott <clayton.scott at gmail.com> wrote:
>
> I want want both '/login' and '/login/*' to go to the same App but I
> can't see how to do it
> short of overriding _parse_path in a sub-class.

I ended up sub classing CA::Dispatch::Regexp and overriding _parse_path so I
could do:

    My::Dispatcher->dispatch(
                 prefix  => 'My::App::Dashboard',
                 table   => [
                             qr|/|           => { app => 'Home' },
                             qr|/login|   => { app => 'Login::Ajax' },
                 ],
         );

Clayton

>
> In my table I've tried using the key 'login', 'login*', 'login/*' but
> one will always fail to match
> one or the other.
>
> Please tell me there's another way to do it!
>
> index.cgi
> #!/usr/bin/perl
>     CGI::Application::Dispatch->dispatch(
>                 prefix  => 'My::App::Dashboard',
>                 table   => [
>                             ''           => { app => 'Home' },
>                             'login*'   => { app => 'Login::Ajax' },
> #matches 'login/' but not 'login'
>                 ],
>                 debug   => 1,
>         );
>
>
>
>
>
> Thanks,
> Clayton



--

Clayton Scott
clayton.scott at gmail.com


More information about the cgiapp mailing list