line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package VarGuard::Hash; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
48
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
VarGuard::Hash - safe clean blocks for variables |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 SYNOPSIS |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
see VarGuard |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
2075
|
use Tie::Hash; |
|
1
|
|
|
|
|
8983
|
|
|
1
|
|
|
|
|
45
|
|
17
|
1
|
|
|
1
|
|
14
|
use base qw(Tie::StdHash); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
782
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my %cb; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub TIEHASH { |
22
|
0
|
|
|
0
|
|
|
my $class = shift; |
23
|
0
|
|
|
|
|
|
my $self = $class->SUPER::TIEHASH; |
24
|
0
|
|
|
|
|
|
$cb{0+$self} = $_[0]; |
25
|
0
|
|
|
|
|
|
return $self; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub DESTROY { |
29
|
0
|
|
|
0
|
|
|
my $self = shift; |
30
|
0
|
|
|
|
|
|
my $cb = delete $cb{0+$self}; |
31
|
0
|
0
|
|
|
|
|
$cb->(%$self) if( $cb ); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |