use Plack::Builder; sub check_pass { my( $username, $pass ) = @_; return $username eq $pass; } sub my_app { my $env = shift; my $page = '' . $env->{PATH_INFO} . '
'; if( $env->{'psgix.session'}{user_id} ){ $page .= <{'psgix.session'}{user_id}
END } else{ $page .= 'login'; } $page .= ''; return [ 200, [ 'Content-Type' => 'text/html', ], [ $page ] ]; } builder { enable 'Session'; enable 'Auth::Form', authenticator => \&check_pass; \&my_app }