line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::PObject::Type::ENCRYPT; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ENCRYPT.pm,v 1.3 2003/09/09 00:11:59 sherzodr Exp |
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
115
|
|
6
|
|
|
|
|
|
|
#use diagnostics; |
7
|
3
|
|
|
3
|
|
17
|
use vars ('$VERSION', '@ISA'); |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
150
|
|
8
|
3
|
|
|
3
|
|
21
|
use Carp "croak"; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
386
|
|
9
|
|
|
|
|
|
|
use overload ( |
10
|
4
|
|
|
4
|
|
18
|
'eq' => sub { crypt($_[1], $_[0]->id) eq $_[0]->id }, |
11
|
0
|
0
|
|
0
|
|
0
|
bool => sub { $_[0]->id ? 1 : 0 }, |
12
|
3
|
|
|
|
|
29
|
fallback => 1 |
13
|
3
|
|
|
3
|
|
17
|
); |
|
3
|
|
|
|
|
4
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
@ISA = ("Class::PObject::Type"); |
16
|
|
|
|
|
|
|
$VERSION = "1.00"; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _init { |
19
|
2
|
|
|
2
|
|
4
|
my $self = shift; |
20
|
2
|
50
|
|
|
|
12
|
defined( $self->id ) or return undef; |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
|
|
61
|
my $salt = join '', ('.', '/', 0..9, 'A'..'Z', 'a'..'z')[rand 64, rand 64]; |
23
|
2
|
|
|
|
|
6
|
$self->{id} = crypt($self->id, $salt) |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
__END__ |