line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::IsSorted; |
2
|
|
|
|
|
|
|
$File::IsSorted::VERSION = '0.2.0'; |
3
|
3
|
|
|
3
|
|
88547
|
use strict; |
|
3
|
|
|
|
|
12
|
|
|
3
|
|
|
|
|
79
|
|
4
|
3
|
|
|
3
|
|
11
|
use warnings; |
|
3
|
|
|
|
|
19
|
|
|
3
|
|
|
|
|
64
|
|
5
|
3
|
|
|
3
|
|
13
|
use autodie; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
20
|
|
6
|
3
|
|
|
3
|
|
13633
|
use 5.016; |
|
3
|
|
|
|
|
24
|
|
7
|
3
|
|
|
3
|
|
2800
|
no locale; |
|
3
|
|
|
|
|
1646
|
|
|
3
|
|
|
|
|
15
|
|
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
1450
|
use Moo; |
|
3
|
|
|
|
|
30209
|
|
|
3
|
|
|
|
|
14
|
|
10
|
|
|
|
|
|
|
|
11
|
3
|
|
|
3
|
|
4182
|
use Path::Tiny qw/ path /; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
664
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub is_filehandle_sorted |
14
|
|
|
|
|
|
|
{ |
15
|
10
|
|
|
10
|
1
|
18794
|
my ( $self, $args ) = @_; |
16
|
|
|
|
|
|
|
|
17
|
10
|
|
|
|
|
20
|
my $fh = $args->{fh}; |
18
|
10
|
|
100
|
|
|
39
|
my $id = $args->{id} // 'unknown'; |
19
|
|
|
|
|
|
|
|
20
|
10
|
|
|
|
|
108
|
my $prev = <$fh>; |
21
|
10
|
|
|
|
|
52
|
while ( my $l = <$fh> ) |
22
|
|
|
|
|
|
|
{ |
23
|
23
|
100
|
|
|
|
43
|
if ( $l le $prev ) |
24
|
|
|
|
|
|
|
{ |
25
|
2
|
|
|
|
|
45
|
die "<$l> less-or-equal than <$prev> in $id!"; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
continue |
29
|
|
|
|
|
|
|
{ |
30
|
21
|
|
|
|
|
81
|
$prev = $l; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
8
|
|
|
|
|
54
|
return 1; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub is_file_sorted |
37
|
|
|
|
|
|
|
{ |
38
|
6
|
|
|
6
|
1
|
3008
|
my ( $self, $args ) = @_; |
39
|
|
|
|
|
|
|
|
40
|
6
|
|
|
|
|
12
|
my $path = $args->{path}; |
41
|
6
|
|
33
|
|
|
25
|
my $id = $args->{id} // $path; |
42
|
|
|
|
|
|
|
|
43
|
6
|
|
|
|
|
22
|
return $self->is_filehandle_sorted( |
44
|
|
|
|
|
|
|
{ fh => path($path)->openr, id => $id } ); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |