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