# uses CGI::Application::Plugin::Forward and Authen.. etc # you must know these by now.. sub break_a_leg : Runmode { my $self = shift; $self->__check or return $self->forward('error'); # ... do whatever... } sub __check { my $self = shift; $self->authen or die('no way.'); $self->_my_sub_check_user_input() or return 0; return 1; } #### #more incomplete code.. sub _authen_config { my $self = shift; # authenticate $self->authen->config( DRIVER => [ 'Generic', sub { return $self->_verify_credentials(@_); }, ], LOGIN_SESSION_TIMEOUT => '45m', # TODO change to 35m for release CREDENTIALS => ['authen_username','authen_password','authen_captcha'], STORE => 'Session', LOGIN_RUNMODE => 'login', ); $self->authen->protected_runmodes(qr/^(?!login)/); return 1; }