Xpm.pm

filter: Statementstmt 96.1% 25 / 26 Branchbran 87.5% 7 / 8 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 88.6% 39 / 44 CC 7 SCAR 12.0
CC
7
Cov
92%
_has_transparency
5.4
new
3.0
BEGIN
1.0
CRAP 3.3
« Base.pm ↑ Summary Xbm.pm »
1 # -*- perl -*-
2  
3 # Copyright (C) 2015 Slaven Rezic. All rights reserved.
4 # This package is free software; you can redistribute it and/or
5 # modify it under the same terms as Perl itself.
6  
7 package Imager::Image::Xpm;
8  
9 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 $VERSION = '0.01';
12  
13 1 ▶use base 'Imager::Image::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 ▶use Image::Xpm;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 4 ▶sub new {
Subroutine new: called CC=3 SCAR=11.0
Pod undocumented
18 4 my($class, %opts) = @_;
19 4 my $file = delete $opts{file};
20 4 ▶ die 'file option is mandatory' if !defined $file;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $file 1 3 4
21 3 ▶ die 'Unhandled options: ' . join(' ', %opts) if %opts;
Branch: 1 branch
BranchTrueFalseTotal
if %opts 1 2 3
22 2 my $xpm = Image::Xpm->new(-file => $file);
23 2 Imager::Image::Xpm->convert($xpm);
24 }
25  
26 2 ▶sub _has_transparency {
Subroutine _has_transparency: called CC=5 SCAR=16.8
27 2 my(undef, $image_base) = @_;
28 2 my $palette = $image_base->get('-palette');
29 2 ▶ if ($palette) {
Branch: 1 branch
BranchTrueFalseTotal
if ($palette) 2 0 2
30 2 for my $color_spec (values %$palette) {
31 4 ▶ return 1 if ($color_spec->{'c'}||'') =~m{^none$}i;
Branch: 1 branch
BranchTrueFalseTotal
if ($color_spec->{"c"} || "") =~ /^none$/i 2 2 4
Condition50%1/2
$color_spec->{'c'} || ''
l!l
40
MC/DC0%0/1
$color_spec->{'c'} || ''
$color_spec->{'c'}
Truth table50%1/2
A
A= $color_spec->{'c'}
Aresult
11
00
32 }
33 }
34 0 0;
35 }
36  
37 1 1;
38  
39 __END__
« Base.pm ↑ Summary Xbm.pm »