line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MARC::File::Utils; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 Functions |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head2 byte_substr( $str, $pos, $len ) |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
A utf8-safe version of C. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=cut |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub byte_substr { |
12
|
29
|
|
|
29
|
|
16657
|
use Encode; |
|
29
|
|
|
|
|
256600
|
|
|
29
|
|
|
|
|
2299
|
|
13
|
29
|
|
|
29
|
|
207
|
use bytes; |
|
29
|
|
|
|
|
40
|
|
|
29
|
|
|
|
|
136
|
|
14
|
0
|
|
|
0
|
1
|
|
my ( $str, $pos, $len ) = @_; |
15
|
0
|
|
|
|
|
|
my $utf8 = substr( $str, $pos, $len ); |
16
|
0
|
|
|
|
|
|
return decode( 'utf8', $utf8 ); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head2 byte_length |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
A utf8-safe version of C. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub byte_length { |
26
|
29
|
|
|
29
|
|
1865
|
use bytes; |
|
29
|
|
|
|
|
179
|
|
|
29
|
|
|
|
|
113
|
|
27
|
0
|
|
|
0
|
1
|
|
my $str = shift; |
28
|
0
|
|
|
|
|
|
return length( $str ); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |