use Dancer::Plugin::Passphrase; post '/user/add' => sub { my $args = valid_input('/user/add') or return template 'user/add'; my $pwhash = passphrase( $args->{password} )->generate_hash; my $user = User->new({ username => $args->{username}, full_name => $args->{full_name}, email => $args->{email}, password => "$pwhash", # obj overloads stringification active => 1, admin => 0, }); $user->insert; flash "User successfully added"; redirect '/user'; };