line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::IsSorted; |
2
|
|
|
|
|
|
|
$File::IsSorted::VERSION = '0.0.6'; |
3
|
2
|
|
|
2
|
|
108547
|
use strict; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
60
|
|
4
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
60
|
|
5
|
2
|
|
|
2
|
|
12
|
use autodie; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
24
|
|
6
|
2
|
|
|
2
|
|
10994
|
use 5.016; |
|
2
|
|
|
|
|
18
|
|
7
|
2
|
|
|
2
|
|
1097
|
no locale; |
|
2
|
|
|
|
|
1290
|
|
|
2
|
|
|
|
|
13
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
1200
|
use Moo; |
|
2
|
|
|
|
|
23752
|
|
|
2
|
|
|
|
|
20
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
3339
|
use Path::Tiny qw/ path /; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
524
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub is_filehandle_sorted |
14
|
|
|
|
|
|
|
{ |
15
|
5
|
|
|
5
|
1
|
23378
|
my ( $self, $args ) = @_; |
16
|
|
|
|
|
|
|
|
17
|
5
|
|
|
|
|
13
|
my $fh = $args->{fh}; |
18
|
5
|
|
100
|
|
|
21
|
my $id = $args->{id} // 'unknown'; |
19
|
|
|
|
|
|
|
|
20
|
5
|
|
|
|
|
49
|
my $prev = <$fh>; |
21
|
5
|
|
|
|
|
41
|
while ( my $l = <$fh> ) |
22
|
|
|
|
|
|
|
{ |
23
|
15
|
100
|
|
|
|
31
|
if ( $l le $prev ) |
24
|
|
|
|
|
|
|
{ |
25
|
1
|
|
|
|
|
27
|
die "<$l> less-or-equal than <$prev> in $id!"; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
continue |
29
|
|
|
|
|
|
|
{ |
30
|
14
|
|
|
|
|
55
|
$prev = $l; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
4
|
|
|
|
|
37
|
return 1; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub is_file_sorted |
37
|
|
|
|
|
|
|
{ |
38
|
4
|
|
|
4
|
1
|
2151
|
my ( $self, $args ) = @_; |
39
|
|
|
|
|
|
|
|
40
|
4
|
|
|
|
|
9
|
my $path = $args->{path}; |
41
|
4
|
|
33
|
|
|
21
|
my $id = $args->{id} // $path; |
42
|
|
|
|
|
|
|
|
43
|
4
|
|
|
|
|
17
|
return $self->is_filehandle_sorted( |
44
|
|
|
|
|
|
|
{ fh => path($path)->openr, id => $id } ); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |