line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tie::File::AnyData; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
52940
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
62
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
45
|
|
5
|
2
|
|
|
2
|
|
8
|
use Carp; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
150
|
|
6
|
2
|
|
|
2
|
|
2162
|
use Tie::File; |
|
2
|
|
|
|
|
37523
|
|
|
2
|
|
|
|
|
145
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub TIEARRAY |
11
|
|
|
|
|
|
|
{ |
12
|
5
|
|
|
5
|
|
4063
|
my ($pack,$file,%opts) = @_; |
13
|
5
|
|
|
|
|
6
|
my $code; |
14
|
|
|
|
|
|
|
## We process $opts{'code'} (if present). |
15
|
5
|
100
|
|
|
|
15
|
if (defined $opts{'code'}){ |
16
|
3
|
|
|
|
|
4
|
$code = $opts{'code'}; |
17
|
3
|
|
|
|
|
7
|
delete $opts{'code'}; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
## We override Tie::File::_read_record. |
20
|
2
|
|
|
2
|
|
26
|
no warnings 'redefine'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
350
|
|
21
|
|
|
|
|
|
|
*Tie::File::_read_record = sub { |
22
|
512
|
|
|
512
|
|
2296
|
my ($self) = @_; |
23
|
512
|
|
|
|
|
392
|
my $rec; |
24
|
512
|
|
|
|
|
880
|
$rec = $self -> {_get_next_rec} -> ($self->{'fh'}); |
25
|
512
|
|
|
|
|
18552
|
return $rec; |
26
|
|
|
|
|
|
|
} |
27
|
3
|
|
|
|
|
95
|
} |
28
|
|
|
|
|
|
|
## After processing the (optional) extra option we call Tie::File::TIEARRAY |
29
|
5
|
|
|
|
|
7
|
my $self; |
30
|
5
|
|
|
|
|
8
|
eval { $self = Tie::File::TIEARRAY("Tie::File",$file,%opts) }; |
|
5
|
|
|
|
|
16
|
|
31
|
5
|
|
|
|
|
738
|
$@ =~ s/at.+//s; |
32
|
5
|
100
|
|
|
|
103
|
croak $@ if ($@); |
33
|
4
|
|
|
|
|
20
|
$self->{_get_next_rec} = $code; |
34
|
4
|
|
|
|
|
14
|
return $self; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |