blib/lib/Imager/QRCode.pm

filter: Statementstmt 83.7% 36 / 43 Branchbran 33.3% 4 / 12 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 90.9% 10 / 11 Podpod 100% 3 / 3 totaltotal 68.8% 53 / 77 CC 9 SCAR 22.1
CC
9
Cov
67%
plot_qrcode
30.0
BEGIN
2.3
new
2.0
CRAP 9.1
↑ Summary src/mmask.c »
1 package Imager::QRCode;
2  
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use vars qw(@ISA $VERSION @EXPORT_OK);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 @EXPORT_OK = qw(plot_qrcode);
9  
10 3 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use Imager 0.55;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 3 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=8.1
14 3 $VERSION = '0.035';
15 eval {
16 3 require XSLoader;
17 3 XSLoader::load('Imager::QRCode', $VERSION);
18 3 1;
19 3 ▶ } or do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { require XSLoader; XSLoader::load("Imager::QRCode", $Imager::QRCode::VERSION); 1 } } or do { require DynaLoader; push @Imager::QRCode::ISA, "DynaLoader"; "Imager::QRCode"->bootstrap($Imager::QRCode::VERSION) } 3 0 3
20 0 require DynaLoader;
21 0 push @ISA, 'DynaLoader';
22 0 bootstrap Imager::QRCode $VERSION;
23 };
24 }
25  
26 8 ▶sub new {
Subroutine new: called CC=2 SCAR=7.1
Pod documented
27 8 my $class = shift;
28 8 ▶ my $params = scalar ref $_[0] eq 'HASH' ? $_[0] : { @_ };
Branch: 1 branch
BranchTrueFalseTotal
scalar ref $_[0] eq 'HASH' ? : 0 8 8
29 8 return bless { params => $params }, $class;
30 }
31  
32 8 ▶sub plot {
Subroutine plot: called CC=2 SCAR=7.1
Pod documented
33 8 my ( $self, $text ) = @_;
34 8 ▶ defined $text or croak 'Not enough arguments for plot()';
Branch: 1 branch
BranchTrueFalseTotal
defined $text or croak("Not enough arguments for plot()") 8 0 8
35 8 return _imager( _plot($text, $self->{params}) );
36 }
37  
38 0 ▶sub plot_qrcode {
Subroutine plot_qrcode: not called CC=5 SCAR=34.0
Pod documented
39 0 my ( $text, $params ) = @_;
40 0 ▶ defined $text or croak 'Not enough arguments for plot()';
Branch: 1 branch
BranchTrueFalseTotal
defined $text or croak("Not enough arguments for plot()") 0 0 0
41 0 ▶ $params ||= {} if !$params || ref $params ne 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if not $params or ref $params ne "HASH" 0 0 0
Condition0%0/5
not $params or ref $params ne "HASH"
l!l&&r!l&&!r
000
$params ||= {}
l!l
00
MC/DC0%0/2
not $params or ref $params ne "HASH"
not $params ref $params ne "HASH"
MC/DC0%0/1
$params ||= {}
$params
Truth table0%0/3
not(A) or B
A= not $paramsB= ref $params ne "HASH"
ABresult
1X1
011
000
Truth table0%0/2
A
A= $params
Aresult
11
00
42 0 return _imager( _plot( $text, $params ) );
43 }
44  
45 6 ▶sub _imager {
Subroutine _imager: called CC=2 SCAR=7.0
46 6 my $raw = shift;
47 6 ▶ ref $raw eq 'Imager::ImgRaw' or croak "_imager() argument must be Imager::ImgRaw";
Branch: 1 branch
BranchTrueFalseTotal
ref $raw eq "Imager::ImgRaw" or croak("_imager() argument must be Imager::ImgRaw") 6 0 6
48 6 my $img = Imager->new;
49 6 $img->{IMG} = $raw;
50 6 return $img;
51 }
52  
53 3 1; # Magic true value required at end of module
54 __END__
↑ Summary src/mmask.c »