[cgiapp] [Announce] CGI::Application::Plugin::Routes v1.01 now on
cpan
Porta
julian.porta at gmail.com
Wed Jun 10 18:04:34 EDT 2009
I will review CAP::Auth to see what you can do, and see if I can ease the
interaction with Routes.I never used CAP::Auth. I already wrote my
login/logout/auth routines (with session based checks) packed into a
controller that I just drop in on all my projects.
On Wed, Jun 10, 2009 at 6:51 PM, P Kishor <punk.kish at gmail.com> wrote:
> On Wed, Jun 10, 2009 at 4:41 PM, Porta<julian.porta at gmail.com> wrote:
> > Honestly, I haven't used CAP::Auth so it's hard for me to know how it
> works.
> > How does it generate a runmode from the login form?How do you handle that
> *
> > without* CAP::Routes?
> >
> >
>
> I was hoping you wouldn't ask me that ;-). Frankly, CAP::Auth is a bit
> of a mystery to me, which is why I have thought of rewriting its
> functionality myself into a much simpler module, but I am trying to
> stay away from rolling my own as much as possible based on the
> assumption that Cees Hek is a much better programmer than I am.
>
> As far as I understand, CAP::Auth exports one single method called
> 'authen' through which it exposes all its functionality. To designate
> a run mode as protected, I do the following in my setup
>
> $self->authen->protected_runmodes('runmode1', 'runmode2');
>
> where runmode1 and runmode2 are the run modes that I want to protect.
>
> I looked at its default login form on the client side, the one that
> CAP::Auth generates if no alternative is provided, and saw that it has
> a hidden form field called 'rm' with the value set to 'authen_login'
> like so
>
> <input type="hidden" name="rm" value="authen_login">
>
> When the user enters the username and password and submits the form,
> my sense is that the $self->authen->protected_runmodes('runmode1',
> 'runmode2') invocation above allows CAP::Auth to intercept the query
> and ensure that the authentication takes place.
>
> All this works fine with C::A::Dispatch, but fails with Routes.
>
> Hope this helps you help me. If not, let me ask you another question
> -- how do you recommend authentication while using your Routes module?
>
> I am very keen on using your module as I like its simplicity as
> compared to C::A::Dispatch, so am hoping for some clarification on
> this.
>
> Many thanks,
>
>
>
>
> > On Wed, Jun 10, 2009 at 4:11 PM, P Kishor <punk.kish at gmail.com> wrote:
> >
> >> Hi,
> >>
> >> CAP::Routes now installs fine, and seems to work, mostly. I am having
> >> a bit of difficulty trying to make it work with CAP::Authentication
> >> and as a replacement for CA::Dispatch .
> >>
> >> With CAD and CAP::Authentication, I have the following that works
> >>
> >> # in index.cgi
> >> CGI::Application::Dispatch->dispatch(
> >> table => [
> >> welcome => { app => 'App', rm => 'welcome' },
> >> view => { app => 'App', rm => 'view' },
> >> ],
> >> );
> >>
> >> # in App.pm
> >> sub setup {
> >> my $self = shift;
> >>
> >> $self->start_mode("welcome");
> >> $self->mode_param(param => 'rm');
> >> $self->run_modes(
> >> welcome => 'welcome',
> >> view => 'view',
> >> );
> >>
> >> $self->authen->protected_runmodes('view');
> >> }
> >>
> >> Then I replace the above with the following
> >> # in index.cgi
> >> App->new(
> >> TMPL_PATH => ..,
> >> PARAMS => {
> >> ..
> >> },
> >> )->run();
> >>
> >> # and in App.pm
> >> sub setup {
> >> my $self = shift;
> >>
> >> $self->routes([
> >> welcome => 'welcome',
> >> view => 'view',
> >> ]);
> >> $self->start_mode('welcome');
> >>
> >> $self->authen->protected_runmodes('view');
> >> }
> >>
> >> But now, I get the error "Error executing run mode 'authen_login':
> >> Can't locate object method "authen_login" via package "App"...
> >>
> >> This 'authen_login' run mode is being generated by the login form from
> >> CAP::Authentication.
> >>
> >> On Thu, Jun 4, 2009 at 7:44 PM, Porta<julian.porta at gmail.com> wrote:
> >> > Damn typo...
> >> > Thanks for the advice. Just uploaded the fixed version to cpan...
> should
> >> be
> >> > available sometime tomorrow.
> >> >
> >> > I'll take a close look to the cpantesters (I haven't noticed it
> existence
> >> > before).
> >> >
> >> >
> >> > On Thu, Jun 4, 2009 at 9:19 PM, P Kishor <punk.kish at gmail.com> wrote:
> >> >
> >> >> On Thu, Jun 4, 2009 at 7:12 PM, Porta <julian.porta at gmail.com>
> wrote:
> >> >> > Damn....
> >> >> > thanks for the feedback... will look into it.
> >> >> >
> >> >>
> >> >> Thanks. While you are investigating, note that it fails on just about
> >> >> every platform. See
> >> >>
> >> >>
> http://www.cpantesters.org/distro/C/CGI-Application-Plugin-Routes.html
> >> >>
> >> >>
> >> >> > On Thu, Jun 4, 2009 at 9:09 PM, P Kishor <punk.kish at gmail.com>
> wrote:
> >> >> >
> >> >> >> On Wed, Jun 3, 2009 at 5:28 PM, Porta <julian.porta at gmail.com>
> >> wrote:
> >> >> >> > Hi folks.
> >> >> >> >
> >> >> >> > Just in case anyone's interested,
> CGI::Application::Plugin::Routes
> >> hit
> >> >> >> v1.01
> >> >> >> > and it's available on CPAN
> >> >> >> >
> >> >> >>
> >> >>
> >>
> http://search.cpan.org/~porta/CGI-Application-Plugin-Routes-1.01/lib/CGI/Application/Plugin/Routes.pm
> >> <
> >>
> http://search.cpan.org/%7Eporta/CGI-Application-Plugin-Routes-1.01/lib/CGI/Application/Plugin/Routes.pm
> >> >
> >> >> <
> >> >>
> >>
> http://search.cpan.org/%7Eporta/CGI-Application-Plugin-Routes-1.01/lib/CGI/Application/Plugin/Routes.pm
> >> >> >
> >> >> >>
> >> >> >> Install failed on my Mac OS X with Perl 5.8.8
> >> >> >>
> >> >> >> Writing Makefile for CGI::Application::Plugin::Routes
> >> >> >> cp lib/CGI/Application/Plugin/Routes.pm
> >> >> >> blib/lib/CGI/Application/Plugin/Routes.pm
> >> >> >> Manifying blib/man3/CGI::Application::Plugin::Routes.3
> >> >> >> PORTA/CGI-Application-Plugin-Routes-1.01.tar.gz
> >> >> >> /usr/bin/make -- OK
> >> >> >> Running make test
> >> >> >> PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM"
> "-e"
> >> >> >> "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
> >> >> >> t/00-load.........Calling package is not a CGI::Application module
> so
> >> >> >> not setting up the prerun hook. If you are using @ISA instead of
> >> 'use
> >> >> >> base', make sure it is in a BEGIN { } block, and make sure these
> >> >> >> statements appear before the plugin is loaded at
> >> >> >>
> >> >> >>
> >> >>
> >>
> /Users/punkish/.cpan/build/CGI-Application-Plugin-Routes-1.01-frSwPF/blib/lib/CGI/Application/Plugin/Routes.pm
> >> >> >> line 25.
> >> >> >> # Testing CGI::Application::Plugin::Routes 1.01, Perl 5.008008,
> >> >> >> /usr/local/bin/perl
> >> >> >> t/00-load.........ok
> >> >> >> t/basic...........Error executing class callback in prerun stage:
> >> >> >> Can't locate object method "route_params" via package "TestApp" at
> >> >> >>
> >> >> >>
> >> >>
> >>
> /Users/punkish/.cpan/build/CGI-Application-Plugin-Routes-1.01-frSwPF/blib/lib/CGI/Application/Plugin/Routes.pm
> >> >> >> line 104.
> >> >> >> # Looks like your test exited with 2 before it could output
> anything.
> >> >> >> t/basic...........dubious
> >> >> >> Test returned status 2 (wstat 512, 0x200)
> >> >> >> t/boilerplate.....ok
> >> >> >> 2/3 unexpectedly succeeded
> >> >> >> TODO PASSED tests 2-3
> >> >> >>
> >> >> >> t/pod-coverage....
> >> >> >> # Failed test 'Pod coverage on CGI::Application::Plugin::Routes'
> >> >> >> # at /usr/local/lib/perl5/site_perl/5.8.8/Test/Pod/Coverage.pm
> line
> >> >> 126.
> >> >> >> # Coverage for CGI::Application::Plugin::Routes is 80.0%, with 1
> >> naked
> >> >> >> subroutine:
> >> >> >> # routes_params
> >> >> >> t/pod-coverage....NOK 1/1# Looks like you failed 1 test of 1.
> >> >> >> t/pod-coverage....dubious
> >> >> >> Test returned status 1 (wstat 256, 0x100)
> >> >> >> DIED. FAILED test 1
> >> >> >> Failed 1/1 tests, 0.00% okay
> >> >> >> t/pod.............ok
> >> >> >> Failed Test Stat Wstat Total Fail List of Failed
> >> >> >>
> >> >> >>
> >> >>
> >>
> -------------------------------------------------------------------------------
> >> >> >> t/basic.t 2 512 ?? ?? ??
> >> >> >> t/pod-coverage.t 1 256 1 1 1
> >> >> >> (2 subtests UNEXPECTEDLY SUCCEEDED).
> >> >> >> Failed 2/5 test scripts. 1/6 subtests failed.
> >> >> >> Files=5, Tests=6, 1 wallclock secs ( 0.19 cusr + 0.06 csys =
> 0.25
> >> >> CPU)
> >> >> >> Failed 2/5 test programs. 1/6 subtests failed.
> >> >> >> make: *** [test_dynamic] Error 255
> >> >> >> PORTA/CGI-Application-Plugin-Routes-1.01.tar.gz
> >> >> >> /usr/bin/make test -- NOT OK
> >> >> >> //hint// to see the cpan-testers results for installing this
> module,
> >> >> try:
> >> >> >> reports PORTA/CGI-Application-Plugin-Routes-1.01.tar.gz
> >> >> >> Running make install
> >> >> >> make test had returned bad status, won't install without force
> >> >> >> Failed during this command:
> >> >> >> PORTA/CGI-Application-Plugin-Routes-1.01.tar.gz: make_test NO
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> >
> >> >> >> > Enjoy.
> >> >> >> >
> >> >> >> >
> >> >> >> > Porta.
> >> >> >> >
> >>
> >> ##### 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/ ##
> >> ## ##
> >> ################################################################
> >>
> >>
> >
> > ##### 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/ ##
> > ## ##
> > ################################################################
> >
> >
>
> ##### 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/ ##
> ## ##
> ################################################################
>
>
More information about the cgiapp
mailing list