Guest User

Untitled

a guest
Apr 25th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use Test::More tests => 2;
  5.  
  6. {
  7. package User;
  8. use Moose;
  9. use MooseX::Attribute::Hashed;
  10.  
  11. has 'password' => (
  12. traits => ['Hashed::Crypt'],
  13. salt => sub {'$5$pants'},
  14. is => 'rw',
  15. isa => 'Str',
  16. );
  17.  
  18. has 'monkey' => (
  19. traits => ['Hashed::Digest'],
  20. digest => 'SHA1',
  21. is => 'rw',
  22. isa => 'Str',
  23. );
  24.  
  25.  
  26. }
  27.  
  28. my $user = User->new(password => 'cake', monkey => 'baboon');
  29. is($user->password,
  30. '$5$pants$ox3UoVtWH2HCQ4djLirh1xrPZv4olI.GRaXDDbx8ZM6');
  31. is($user->monkey,
  32. 'oyF+OthF4+ikjsQRSAWQ5dm+dHU');
Add Comment
Please, Sign In to add comment