line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::NonWideChar::Util; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2021-04-14'; # DATE |
4
|
|
|
|
|
|
|
our $VERSION = '0.003'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
55975
|
use strict; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
23
|
|
7
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use Exporter qw(import); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
157
|
|
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
11
|
|
|
|
|
|
|
length_height |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub length_height { |
15
|
4
|
|
|
4
|
1
|
996
|
my $text = shift; |
16
|
4
|
|
|
|
|
6
|
my $num_lines = 0; |
17
|
4
|
|
|
|
|
6
|
my $len = 0; |
18
|
4
|
|
|
|
|
20
|
for my $e (split /(\r?\n)/, $text) { |
19
|
8
|
100
|
|
|
|
18
|
if ($e =~ /\n/) { |
20
|
3
|
|
|
|
|
4
|
$num_lines++; |
21
|
3
|
|
|
|
|
5
|
next; |
22
|
|
|
|
|
|
|
} |
23
|
5
|
100
|
|
|
|
11
|
$num_lines = 1 if $num_lines == 0; |
24
|
5
|
|
|
|
|
6
|
my $l = length($e); |
25
|
5
|
100
|
|
|
|
11
|
$len = $l if $len < $l; |
26
|
|
|
|
|
|
|
} |
27
|
4
|
|
|
|
|
19
|
[$len, $num_lines]; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
# ABSTRACT: Utility routines for text |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__END__ |