File/Utils.pm

filter: Statementstmt 66.6% 10 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod 100% 2 / 2 totaltotal 68.1% 15 / 22 CC 1 SCAR 3.4
CC
1
Cov
67%
byte_substr
2.0
byte_length
2.0
BEGIN
1.0
CRAP 1.4
« Record.pm ↑ Summary
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<substr()>.
8  
9 =cut
10  
11 sub byte_substr {
12 30 ▶ use Encode;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 30 ▶ use bytes;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 0 ▶ my ( $str, $pos, $len ) = @_;
Subroutine byte_substr: not called CC=1 SCAR=6.9
Pod documented
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<length()>.
22  
23 =cut
24  
25 sub byte_length {
26 30 ▶ use bytes;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 0 ▶ my $str = shift;
Subroutine byte_length: not called CC=1 SCAR=6.9
Pod documented
28 0 return length( $str );
29 }
30  
31 30 1;
« Record.pm ↑ Summary