Write validation helpers 

post '/user/add' => sub {
    my $args = valid_input('/user/add')
        or return template 'user/add';

    # ... insert user record in DB ...

    flash "User successfully added";
    redirect '/user';
};