line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::NonWideChar::Util; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2021-01-23'; # DATE |
4
|
|
|
|
|
|
|
our $VERSION = '0.002'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
58321
|
use strict; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
28
|
|
7
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use Exporter qw(import); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
156
|
|
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
11
|
|
|
|
|
|
|
length_height |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub length_height { |
15
|
4
|
|
|
4
|
1
|
1069
|
my $text = shift; |
16
|
4
|
|
|
|
|
5
|
my $num_lines = 0; |
17
|
4
|
|
|
|
|
5
|
my $len = 0; |
18
|
4
|
|
|
|
|
21
|
for my $e (split /(\r?\n)/, $text) { |
19
|
8
|
100
|
|
|
|
17
|
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
|
|
|
|
|
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__ |