line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
##-*- Mode: CPerl -*- |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## File: Tie/File/Indexed/StorableN.pm |
4
|
|
|
|
|
|
|
## Author: Bryan Jurish |
5
|
|
|
|
|
|
|
## Description: tied array access to indexed data files: Storable-encoded references (network byte-order) |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Tie::File::Indexed::StorableN; |
8
|
2
|
|
|
2
|
|
1507
|
use Tie::File::Indexed::Storable; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
51
|
|
9
|
2
|
|
|
2
|
|
7
|
use Storable; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
81
|
|
10
|
2
|
|
|
2
|
|
7
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
180
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
##====================================================================== |
13
|
|
|
|
|
|
|
## Globals |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our @ISA = qw(Tie::File::Indexed::Storable); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
##====================================================================== |
18
|
|
|
|
|
|
|
## Subclass API: Data I/O: overrides |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
## $bool = $tfi->writeData($utf8_string) |
21
|
|
|
|
|
|
|
## + override transparently encodes $data using Storable::nstore_fd() |
22
|
|
|
|
|
|
|
sub writeData { |
23
|
10
|
100
|
|
10
|
1
|
15
|
return 1 if (!defined($_[1])); ##-- don't waste space on undef |
24
|
9
|
|
|
|
|
16
|
return Storable::nstore_fd($_[1],$_[0]{datfh}); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; ##-- be happpy |