line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::NonWideChar::Util; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2021-04-16'; # DATE |
4
|
|
|
|
|
|
|
our $VERSION = '0.004'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
55930
|
use strict; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
25
|
|
7
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
4
|
use Exporter qw(import); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
160
|
|
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
11
|
|
|
|
|
|
|
length_height |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub length_height { |
15
|
4
|
|
|
4
|
1
|
1017
|
my $text = shift; |
16
|
4
|
|
|
|
|
6
|
my $num_lines = 0; |
17
|
4
|
|
|
|
|
8
|
my $len = 0; |
18
|
4
|
|
|
|
|
18
|
for my $e (split /(\r?\n)/, $text) { |
19
|
8
|
100
|
|
|
|
19
|
if ($e =~ /\n/) { |
20
|
3
|
|
|
|
|
5
|
$num_lines++; |
21
|
3
|
|
|
|
|
5
|
next; |
22
|
|
|
|
|
|
|
} |
23
|
5
|
100
|
|
|
|
11
|
$num_lines = 1 if $num_lines == 0; |
24
|
5
|
|
|
|
|
7
|
my $l = length($e); |
25
|
5
|
100
|
|
|
|
10
|
$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__ |