Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Catalyst controller comparison fails in Root controller auto()

by hobbs (Monk)
on Jan 11, 2009 at 06:10 UTC ( [id://735472]=note: print w/replies, xml ) Need Help??


in reply to Catalyst controller comparison fails in Root controller auto()

I'm not really sure that comparing the stringified values of controller objects can be considered kosher. Perhaps you could compare the values of action_namespace called on the controllers, or simply change your logic to use $c->req->path instead of $c->controller?

Replies are listed 'Best First'.
Re^2: Catalyst controller comparison fails in Root controller auto()
by smallvaluesof2 (Novice) on Jan 11, 2009 at 14:15 UTC
    Hi, thanks for your response. I followed the example in the CPAN catalyst tutorial on authentication, assuming it to be good initial practice. I will try out your suggestions and report back.
      Hi. I hadn't seen that example in the tutorial. It should work, and there may be an underlying bug with -r, but I'm still not convinced that it really represents good practice.

      rafl recommended (in #catalyst IRC) doing the following: add a :NoAuth attribute to your login/register/etc. actions (note: actions, not controllers), and then check

      if ($c->action->attributes->{NoAuth})
      to decide whether to bypass auth.

        I will summarize my experiences in a single reply here

        Running catalyst without the -r worked well enough for my development purposes.

        I tried the various suggestions put forth:

        1. $self->action_namespace
        2. $c->req->path
        3. $c->action->attributes->{NoAuth}

        They all worked but I found setting :NoAuth attribute most suitable to my needs as it gave me the precision of labelling those few actions permitted without being logged in, without the need to specify the complete path to them (which might change as I build my site).

        Thanks, everyone for your help. Much appreciated

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://735472]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-24 09:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found