File Coverage

blib/lib/DBIx/Class/InflateColumn/Crypt/Passphrase.pm
Criterion Covered Total %
statement 26 26 100.0
branch 4 4 100.0
condition n/a
subroutine 9 9 100.0
pod 1 1 100.0
total 40 40 100.0


line stmt bran cond sub pod time code
1             package DBIx::Class::InflateColumn::Crypt::Passphrase;
2             $DBIx::Class::InflateColumn::Crypt::Passphrase::VERSION = '0.009';
3 4     4   448357 use strict;
  4         10  
  4         162  
4 4     4   22 use warnings;
  4         8  
  4         270  
5              
6 4     4   47 use parent 'DBIx::Class';
  4         9  
  4         34  
7              
8 4     4   57329 use Crypt::Passphrase 0.007;
  4         27449  
  4         32  
9 4     4   242 use Scalar::Util 'blessed';
  4         10  
  4         284  
10              
11 4     4   22 use namespace::clean;
  4         8  
  4         46  
12              
13             sub register_column {
14 4     4 1 11611 my ($self, $column, $info, @rest) = @_;
15              
16 4         30 $self->next::method($column, $info, @rest);
17 4 100       2814 return unless my $encoding = $info->{inflate_passphrase};
18              
19 2 100       11 my $crypt_passphrase = blessed($encoding) ? $encoding : Crypt::Passphrase->new(%{ $encoding });
  1         8  
20              
21             $self->inflate_column(
22             $column => {
23 4     4   87605 inflate => sub { $crypt_passphrase->curry_with_hash(shift) },
24 2     2   414334 deflate => sub { shift->raw_hash },
25             },
26 2         169 );
27             }
28              
29             1;
30              
31             # ABSTRACT: Inflate/deflate columns to passphrase objects
32              
33             __END__