line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package VarGuard::Array; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
47
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
VarGuard::Array - safe clean blocks for variables |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 SYNOPSIS |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
see VarGuard |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
1011
|
use Tie::Array; |
|
1
|
|
|
|
|
3990
|
|
|
1
|
|
|
|
|
42
|
|
17
|
1
|
|
|
1
|
|
26
|
use base qw(Tie::StdArray); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
3620
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my %cb; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub TIEARRAY { |
22
|
0
|
|
|
0
|
|
|
my $class = shift; |
23
|
0
|
|
|
|
|
|
my $self = $class->SUPER::TIEARRAY; |
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; |