line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DWH_File::Tie::Subscripted; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
55
|
use warnings; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
434
|
|
4
|
9
|
|
|
9
|
|
49
|
use strict; |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
367
|
|
5
|
9
|
|
|
9
|
|
81
|
use vars qw( @ISA $VERSION ); |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
506
|
|
6
|
|
|
|
|
|
|
|
7
|
9
|
|
|
9
|
|
54
|
use DWH_File::Subscript; |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
53
|
|
8
|
9
|
|
|
9
|
|
338
|
use DWH_File::Value::Factory; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
51
|
|
9
|
9
|
|
|
9
|
|
7079
|
use DWH_File::Tie; |
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
97
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
@ISA = qw( DWH_File::Tie ); |
12
|
|
|
|
|
|
|
$VERSION = 0.01; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub STORE { |
15
|
132
|
|
|
132
|
|
267
|
my ( $self, $key, $value_in ) = @_; |
16
|
132
|
|
|
|
|
398
|
my $subscript = $self->get_subscript( $key ); |
17
|
|
|
|
|
|
|
my $value = DWH_File::Value::Factory->from_input( $self->{ kernel }, |
18
|
132
|
|
|
|
|
523
|
$value_in ); |
19
|
132
|
|
|
|
|
403
|
my $node = $self->get_node( $subscript ); |
20
|
132
|
100
|
|
|
|
266
|
unless ( $node ) { |
21
|
130
|
|
|
|
|
392
|
$node = $self->node_class->new; |
22
|
130
|
|
|
|
|
368
|
$self->handle_new_node( $node, $subscript, $value ); |
23
|
|
|
|
|
|
|
} |
24
|
132
|
|
|
|
|
499
|
$node->set_value( $value ); |
25
|
|
|
|
|
|
|
# make lazy |
26
|
132
|
|
|
|
|
470
|
$self->{ kernel }->store( $subscript, $node ); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub FETCH { |
30
|
505
|
|
|
505
|
|
2180
|
my $subscript = $_[ 0 ]->get_subscript( $_[ 1 ] ); |
31
|
505
|
100
|
|
|
|
1418
|
my $node = $_[ 0 ]->get_node( $subscript ) or return undef; |
32
|
503
|
|
|
|
|
2703
|
return $node->{ value }->actual_value; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub EXISTS { |
36
|
3
|
|
|
3
|
|
13
|
my $subscript = $_[ 0 ]->get_subscript( $_[ 1 ] ); |
37
|
3
|
50
|
|
|
|
10
|
my $node = $_[ 0 ]->get_node( $subscript ) or return 0; |
38
|
0
|
|
|
|
|
0
|
return 1; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub get_subscript { |
42
|
229
|
|
|
229
|
0
|
1102
|
return DWH_File::Subscript->from_input( @_[ 0, 1 ] ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub get_node { |
46
|
810
|
|
|
810
|
0
|
1230
|
my ( $self, $subscript ) = @_; |
47
|
810
|
|
|
|
|
2469
|
my $data = $self->{ kernel }->fetch( $subscript ); |
48
|
810
|
100
|
|
|
|
2083
|
if ( $data ) { |
49
|
|
|
|
|
|
|
return $self->node_class->from_stored( $self->{ kernel }, |
50
|
675
|
|
|
|
|
2315
|
$data, $subscript ); |
51
|
|
|
|
|
|
|
} |
52
|
135
|
|
|
|
|
378
|
else { return undef } |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
0
|
|
0
|
sub CLEAR { die "Abstract method called" } |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub vanish { |
58
|
2
|
|
|
2
|
0
|
5
|
my ( $self ) = @_; |
59
|
2
|
|
|
|
|
11
|
$self->CLEAR; |
60
|
2
|
|
|
|
|
12
|
$self->{ kernel }->unground( $self ); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
__END__ |