blib/lib/Convert/Binary/C.pm

filter: Statementstmt 100% 38 / 38 Branchbran 90.0% 9 / 10 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 98.3% 58 / 59 CC 8 SCAR 16.7
CC
8
Cov
98%
AUTOLOAD
8.0
BEGIN
1.0
BEGIN
1.0
CRAP 5.3
« examples/elf.pl ↑ Summary support/Test/Harness/Assert.pm »
1 ################################################################################
2 #
3 # MODULE: Convert::Binary::C
4 #
5 ################################################################################
6 #
7 # DESCRIPTION: Convert::Binary::C Perl extension module
8 #
9 ################################################################################
10 #
11 # Copyright (c) 2002-2020 Marcus Holland-Moritz. All rights reserved.
12 # This program is free software; you can redistribute it and/or modify
13 # it under the same terms as Perl itself.
14 #
15 ################################################################################
16  
17 package Convert::Binary::C;
18  
19 61 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 61 ▶use DynaLoader;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 61 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 61 ▶use vars qw( @ISA $VERSION $AUTOLOAD );
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 61 @ISA = qw(DynaLoader);
25  
26 61 $VERSION = '0.84';
27  
28 61 bootstrap Convert::Binary::C $VERSION;
29  
30 # Unfortunately, XS AUTOLOAD isn't supported
31 # by stable perl distributions before 5.8.0.
32  
33 sub AUTOLOAD
34 {
35 6227 ▶ my $self = shift;
Subroutine AUTOLOAD: called CC=8 SCAR=20.8
36 6227 my $opt = $AUTOLOAD;
37 6227 ▶ ref $self or croak "$self is not an object";
Branch: 1 branch
BranchTrueFalseTotal
ref $self or croak("$self is not an object") 0 6227 6227
38 6227 $opt =~ s/.*://;
39 6227 ▶ $opt =~ /^[A-Z]/ or croak "Invalid method $opt called";
Branch: 1 branch
BranchTrueFalseTotal
$opt =~ /^[A-Z]/ or croak("Invalid method $opt called") 1 6226 6227
40 6226 ▶ @_ <= 1 or croak "$opt cannot take more than one argument";
Branch: 1 branch
BranchTrueFalseTotal
@_ <= 1 or croak("$opt cannot take more than one argument") 1 6225 6226
41 6225 ▶ unless (@_ or defined wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@_ or defined wantarray) 21 6204 6225
Condition100%3/3
@_ or defined wantarray
l!l&&r!l&&!r
607612821
MC/DC100%2/2
@_ or defined wantarray
@_ defined wantarray
Truth table100%3/3
A or B
A= @_B= defined wantarray
ABresult
1X1
011
000
42 21 carp "Useless use of $opt in void context";
43 21 return;
44 }
45 6204 my @warn;
46 {
47 6204 ▶ local $SIG{__WARN__} = sub { push @warn, $_[0] };
Subroutine __ANON__: called CC=1 SCAR=0.0
48 6204 $opt = eval { $self->configure( $opt, @_ ) };
49 }
50 6204 for my $w (@warn) {
51 4 $w =~ s/\s+at.*?C\.pm.*//s;
52 4 carp $w;
53 }
54 6204 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 210 5994 6204
55 210 $@ =~ s/\s+at.*?C\.pm.*//s;
56 210 croak $@;
57 }
58 5994 $opt;
59 }
60  
61 61 1;
62  
63 __END__
« examples/elf.pl ↑ Summary support/Test/Harness/Assert.pm »