| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Hub::Knots::FileSystem; |
|
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
43
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use Hub qw/:lib/; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '4.00043'; |
|
5
|
|
|
|
|
|
|
our @EXPORT = qw//; |
|
6
|
|
|
|
|
|
|
our @EXPORT_OK = qw//; |
|
7
|
|
|
|
|
|
|
push our @ISA, qw(Tie::StdHash); |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# Cache |
|
10
|
|
|
|
|
|
|
our %CACHE = (); |
|
11
|
65
|
|
|
65
|
|
532
|
sub _fetch_cached { $CACHE{$_[0]} } |
|
12
|
|
|
|
|
|
|
sub _store_cached { |
|
13
|
26
|
100
|
|
26
|
|
58
|
if(defined $_[1]) { |
|
14
|
23
|
50
|
|
|
|
65
|
_delete_cached($_[0]) if ref($CACHE{$_[0]}); |
|
15
|
23
|
|
|
|
|
205
|
$CACHE{$_[0]} = $_[1]; |
|
16
|
|
|
|
|
|
|
} else { |
|
17
|
3
|
|
|
|
|
12228
|
$_[1]; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
} |
|
20
|
4
|
0
|
|
4
|
|
23
|
sub _delete_cached { map {/^$_[0]/ and delete $CACHE{$_}} keys %CACHE; } |
|
|
0
|
|
|
|
|
0
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Infinite recursion will occur unless 'sys' is initialized. |
|
23
|
1
|
|
|
1
|
|
13
|
sub TIEHASH { bless {'sys'=>{}}, $_[0] } |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Access |
|
26
|
65
|
100
|
|
65
|
|
149
|
sub FETCH { _fetch_cached($_[1]) || _store_cached($_[1], Hub::fetch(@_)); } |
|
27
|
7
|
|
|
7
|
|
31
|
sub STORE { Hub::store(@_); _store_cached($_[1], $_[2]); } |
|
|
7
|
|
|
|
|
19
|
|
|
28
|
4
|
|
|
4
|
|
27
|
sub DELETE { Hub::delete(@_); _delete_cached($_[1]); } |
|
|
4
|
|
|
|
|
11
|
|
|
29
|
|
|
|
|
|
|
1; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=pod:summary Nested data structure which reflects the filesystem |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=pod:synopsis |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=pod:description |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |