On Mon, Jan 26, 2009 at 07:56:53PM +0100, koniczynek wrote:
> sub auto :Private {
>   my ( $self, $c ) = @_;
> 
>   $c->log->debug('action start');
>   if ( ! user_logged_in) {
>     $c->redirect( $c->req->base );
>   } else {
>     $c->detach( $c->action->{name} );
>   } 
>   $c->log->debug('action end');
> }

auto relies on a return value to tell the dispatcher whether to continue or not.
Doing the normal action is the default, detaching to it is redundant, hence:

sub auto :Private {
  my ( $self, $c ) = @_;

  if ( ! user_logged_in) {
    $c->redirect( $c->req->base );
    return 0;
  }

  return 1;
}

This example is pretty much exactly the same as in the main Catalyst pod.
-- 
Lars Balker Rasmussen                                        Consult::Perl

_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to