File Coverage

blib/lib/Set/Associate/NewKey/HashSHA1.pm
Criterion Covered Total %
statement 20 21 95.2
branch n/a
condition n/a
subroutine 7 8 87.5
pod 1 1 100.0
total 28 30 93.3


line stmt bran cond sub pod time code
1 4     4   938 use 5.006;
  4         13  
2 4     4   17 use strict;
  4         4  
  4         83  
3 4     4   13 use warnings;
  4         6  
  4         240  
4              
5             package Set::Associate::NewKey::HashSHA1;
6              
7             # ABSTRACT: Pick a value from the pool based on the SHA1 value of the key
8              
9             our $VERSION = '0.004001';
10              
11             our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
12              
13 4     4   431 use Moose qw( around extends );
  4         318885  
  4         24  
14 4     4   19643 use Digest::SHA1;
  4         2463  
  4         237  
15 4     4   1769 use bigint 0.22 qw( hex );
  4         10488  
  4         22  
16             extends 'Set::Associate::NewKey::PickOffset';
17              
18              
19              
20              
21              
22              
23              
24 0     0 1   sub name { 'hash_sha1' }
25              
26             around get_assoc => sub {
27             my ( $orig, $self, $sa, $key ) = @_;
28             return $self->$orig( $sa, hex Digest::SHA1::sha1_hex($key) );
29             };
30              
31             __PACKAGE__->meta->make_immutable;
32              
33 4     4   126817 no Moose;
  4         9  
  4         38  
34              
35             1;
36              
37             __END__
38              
39             =pod
40              
41             =encoding UTF-8
42              
43             =head1 NAME
44              
45             Set::Associate::NewKey::HashSHA1 - Pick a value from the pool based on the SHA1 value of the key
46              
47             =head1 VERSION
48              
49             version 0.004001
50              
51             =head1 METHODS
52              
53             =head2 name
54              
55             The name of this key assignment method ( C<hash_sha1> )
56              
57             =head1 AUTHOR
58              
59             Kent Fredric <kentnl@cpan.org>
60              
61             =head1 COPYRIGHT AND LICENSE
62              
63             This software is copyright (c) 2017 by Kent Fredric <kentfredric@gmail.com>.
64              
65             This is free software; you can redistribute it and/or modify it under
66             the same terms as the Perl 5 programming language system itself.
67              
68             =cut