| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package DBIx::Class::EncodedColumn::Crypt; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
16882
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
22
|
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
136
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub make_encode_sub { |
|
9
|
2
|
|
|
2
|
0
|
1064
|
my ($class, $col, $args) = @_; |
|
10
|
2
|
|
|
|
|
5
|
my $gen_salt_meth = $args->{'salt'}; |
|
11
|
2
|
100
|
|
|
|
21
|
die "Valid 'salt' is a coderef which returns the salt string." |
|
12
|
|
|
|
|
|
|
unless ref $gen_salt_meth eq 'CODE'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
return sub { |
|
15
|
3
|
|
|
3
|
|
12
|
my ($plain_text, $salt) = @_; |
|
16
|
3
|
|
66
|
|
|
14
|
$salt ||= $gen_salt_meth->(); |
|
17
|
3
|
|
|
|
|
118
|
return crypt($plain_text, $salt); |
|
18
|
1
|
|
|
|
|
8
|
}; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub make_check_sub { |
|
22
|
1
|
|
|
1
|
0
|
6
|
my($class, $col, $args) = @_; |
|
23
|
|
|
|
|
|
|
#fast fast fast |
|
24
|
1
|
|
50
|
|
|
142
|
return eval qq^ sub { |
|
25
|
|
|
|
|
|
|
my \$col_v = \$_[0]->get_column('${col}'); |
|
26
|
|
|
|
|
|
|
\$_[0]->_column_encoders->{${col}}->(\$_[1], \$col_v) eq \$col_v; |
|
27
|
|
|
|
|
|
|
} ^ || die($@); |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__END__; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 NAME |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
DBIx::Class::EncodedColumn::Crypt - Encrypt columns using crypt() |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
L<crypt|http://perldoc.perl.org/functions/crypt.html> |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 AUTHOR |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
wreis: Wallace reis <wreis@cpan.org> |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 LICENSE |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
|
49
|
|
|
|
|
|
|
the same terms as Perl itself. |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=cut |