| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::TimelogTxt::File; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
64130
|
use warnings; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
79
|
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
599
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.21'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
|
9
|
14
|
|
|
14
|
1
|
5703
|
my ($class, $fh, $start, $end) = @_; |
|
10
|
|
|
|
|
|
|
|
|
11
|
14
|
100
|
|
|
|
45
|
die "Missing required file handle or file name.\n" unless defined $fh; |
|
12
|
13
|
100
|
|
|
|
37
|
die "Missing required start marker.\n" unless defined $start; |
|
13
|
12
|
100
|
|
|
|
34
|
die "Missing required end marker.\n" unless defined $end; |
|
14
|
11
|
50
|
|
|
|
29
|
if( !ref $fh ) { |
|
15
|
0
|
|
|
|
|
0
|
my $name = $fh; |
|
16
|
0
|
0
|
|
|
|
0
|
open( $fh, '<', $name ) or die "Unable to open file '$name': $!\n"; |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
|
|
19
|
11
|
|
|
|
|
50
|
my $obj = { |
|
20
|
|
|
|
|
|
|
fh => $fh, |
|
21
|
|
|
|
|
|
|
start => $start, |
|
22
|
|
|
|
|
|
|
startlen => length $start, |
|
23
|
|
|
|
|
|
|
end => $end, |
|
24
|
|
|
|
|
|
|
endlen => length $end, |
|
25
|
|
|
|
|
|
|
stage => 0, |
|
26
|
|
|
|
|
|
|
}; |
|
27
|
|
|
|
|
|
|
|
|
28
|
11
|
|
|
|
|
44
|
return bless $obj, $class; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub readline { |
|
32
|
43
|
|
|
43
|
1
|
106
|
my ($self) = @_; |
|
33
|
|
|
|
|
|
|
|
|
34
|
43
|
100
|
100
|
|
|
320
|
return if $self->{'stage'} > 1 or eof( $self->{'fh'} ); |
|
35
|
|
|
|
|
|
|
|
|
36
|
35
|
|
|
|
|
40
|
my $line; |
|
37
|
35
|
100
|
|
|
|
75
|
if( $self->{'stage'} == 0 ) |
|
38
|
|
|
|
|
|
|
{ |
|
39
|
11
|
|
100
|
|
|
457
|
0 while( defined( $line = readline $self->{'fh'} ) && substr( $line, 0, $self->{'startlen'} ) lt $self->{'start'} ); |
|
40
|
11
|
|
|
|
|
16
|
$self->{'stage'} = 1; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
else |
|
43
|
|
|
|
|
|
|
{ |
|
44
|
24
|
|
|
|
|
61
|
$line = readline $self->{'fh'}; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
35
|
100
|
100
|
|
|
318
|
return $line if !defined $line || substr( $line, 0, $self->{'endlen'} ) lt $self->{'end'}; |
|
48
|
9
|
|
|
|
|
13
|
$self->{'stage'} = 2; |
|
49
|
9
|
|
|
|
|
57
|
return; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
|
53
|
|
|
|
|
|
|
__END__ |