[Catalyst] Catalyst::Plugin::Prototype: current state?

Charlie Garrison garrison at zeta.org.au
Sat Mar 20 16:33:42 GMT 2010

Good morning,

On 20/03/10 at 9:02 AM -0700, Ovid 
<publiustemp-catalyst at yahoo.com> wrote:

>1.  It breaks my app badly.
>You can connect to your server at http://curtis-poes-computer-3.local:3000
>[warn] Calling $c->view() will return a random view unless you specify one of:
>[warn] * $c->config(default_view => "the name of the default view to use")
>[warn] * $c->stash->{current_view} # the name of the view to use for this request
>[warn] * $c->stash->{current_view_instance} # the instance of the view to use for this request
>[warn] NB: in version 5.81, the "random" behavior will not work at all.
>[error] Caught exception in 
>Veure::View::AutoCRUD::JSON->process "must provide object to 
>convert at /Library/Perl/5.10.1/Catalyst/View/JSON.pm line 44"
>I can't tell why from the docs.  This is low priority for me, so I
>stopped using it as I don't (yet) need this feature.

The fix is given in the warning message, eg:

__PACKAGE__->config(default_view => 'TT'); # or whatever the 
name of your view is.

Then you have a 'default' view for your app and Catalyst doesn't 
need to choose one at random. AutoCRUD is adding another view 
and Catalyst doesn't know which one to use by default.

Assigning a default_view in config is good practice anyway; it's 
not just an issue with AutoCRUD. Add it now, and don't get 
bitten later when the same problem crops up with something else 
(eg. adding a view for sending emails).

>3.  It's not clear from the docs (to me) how to restrict access.
>I'm using Catalyst::Controller::ActionRole and a custom role to ensure
>that certain urls can only be accessed by those with admin 
>privileges. I can't tell how to hook this into AutoCRUD. I 
>suppose I could write a
>custom subclass of the plugin, so this is the least of my issues.

How about using C::P::Authorization::ACL, eg:

     [qw/admin/], # user must have role 'admin'

I balked at adding C::P::Authorization::ACL to my app just for 
AutoCRUD, but I couldn't find a better way of adding auth 
restrictions to AutoCRUD. Maybe someone else will suggest 
something more elegant. (I seem to recall reading something a 
while back about performance degradation with 
C::P::Authorization::ACL; can anyone clarify?)


    Ꮚ Charlie Garrison ♊ <garrison at zeta.org.au>
    〠 PO Box 141, Windsor, NSW 2756, Australia

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

More information about the Catalyst mailing list