Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use Test::More tests => 2;
- {
- package User;
- use Moose;
- use MooseX::Attribute::Hashed;
- has 'password' => (
- traits => ['Hashed::Crypt'],
- salt => sub {'$5$pants'},
- is => 'rw',
- isa => 'Str',
- );
- has 'monkey' => (
- traits => ['Hashed::Digest'],
- digest => 'SHA1',
- is => 'rw',
- isa => 'Str',
- );
- }
- my $user = User->new(password => 'cake', monkey => 'baboon');
- is($user->password,
- '$5$pants$ox3UoVtWH2HCQ4djLirh1xrPZv4olI.GRaXDDbx8ZM6');
- is($user->monkey,
- 'oyF+OthF4+ikjsQRSAWQ5dm+dHU');
Add Comment
Please, Sign In to add comment