in reply to CGI::Application::Plugin::Authentication posthook?
sub userid { my $self = shift; $self->session->param('userid') and return $self->session->param('userid'); my $username = $self->authen->username or return; $self->session->param( 'userid' => ($self->_get_user_id($username) or confess()) ); } sub _get_user_id( my ($self,$username) = @_; # your way of accessing the user id # even if it's heavy, it's called once per session }
So what happens here, is if our runmode or whatever does not call userid(), you don't load it.
This can be useful for stressful procedures that you may or may not need.
|
|---|