Labyrinth/DIUtils/Base.pm

filter: Statementstmt 36.6% 11 / 30 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 42.8% 3 / 7 Podpod 100% 4 / 4 totaltotal 30.5% 18 / 59 CC 8 SCAR 24.2
CC
8
Cov
25%
reduce
20.0
rotate
12.0
thumb
12.0
CRAP 11.2
« Labyrinth/Plugins.pm ↑ Summary Labyrinth/Constraints.pm »
1 package Labyrinth::DIUtils::Base;
2  
3 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 $VERSION = '5.32';
8  
9 =head1 NAME
10  
11 Labyrinth::DIUtils::Base - Base Digital Image Driver for Labyrinth.
12  
13 =head1 SYNOPSIS
14  
15 use Labyrinth::DIUtils::Base;
16  
17 my $hook = Labyrinth::DIUtils::Base->new($file);
18 my $hook = $hook->rotate($degrees); # 0 - 360
19 my $hook = $hook->reduce($xmax,$ymax);
20 my $hook = $hook->thumb($thumbnail,$square);
21  
22 =head1 DESCRIPTION
23  
24 Handles the driver software for image manipulation; Do not use
25 this module directly, access via Labyrinth::DIUtils.
26  
27 This package is a basic package, for use with websites that do not require
28 any image processing. To provide image processing, install one of the drivers
29 available, currently these are:
30  
31 =over
32  
33 =item * Labyrinth::DIUtils::GD
34  
35 Uses GD graphics library.
36  
37 =item * Labyrinth::DIUtils::ImageMagick
38  
39 Uses ImageMagick image library.
40  
41 =back
42  
43 =cut
44  
45 #############################################################################
46 #Modules/External Subroutines #
47 #############################################################################
48  
49 #############################################################################
50 #Subroutines
51 #############################################################################
52  
53 =head1 METHODS
54  
55 =head2 Contructor
56  
57 =over 4
58  
59 =item new($file)
60  
61 The constructor. Passed a single mandatory argument, which is then used as the
62 image file for all image manipulation.
63  
64 =back
65  
66 =cut
67  
68 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
69 0 my $self = shift;
70 0 my $image = shift;
71  
72 0 my $atts = {
73 'image' => $image,
74 'object' => undef,
75 };
76  
77 # create the object
78 0 bless $atts, $self;
79 0 return $atts;
80 }
81  
82  
83 =head2 Image Manipulation
84  
85 =over 4
86  
87 =item rotate($degrees)
88  
89 By default no processing performed.
90  
91 =cut
92  
93 0 ▶sub rotate {
Subroutine rotate: not called CC=3 SCAR=24.8
Pod documented
94 0 my $self = shift;
95 0 ▶ my $degs = shift || return;
Condition0%0/2
shift() || (return)
l!l
00
MC/DC0%0/1
shift() || (return)
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
96  
97 0 ▶ return unless($self->{image});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"image"} 0 0 0
98 0 return;
99 }
100  
101 =item reduce($xmax,$ymax)
102  
103 By default no processing performed.
104  
105 =cut
106  
107 0 ▶sub reduce {
Subroutine reduce: not called CC=4 SCAR=30.0
Pod documented
108 0 my $self = shift;
109 0 ▶ my $xmax = shift || 100;
Condition0%0/2
shift() || 100
l!l
00
MC/DC0%0/1
shift() || 100
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
110 0 ▶ my $ymax = shift || 100;
Condition0%0/2
shift() || 100
l!l
00
MC/DC0%0/1
shift() || 100
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
111  
112 0 ▶ return unless($self->{image});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"image"} 0 0 0
113 0 return;
114 }
115  
116 =item thumb($thumbnail,$square)
117  
118 By default no processing performed.
119  
120 =back
121  
122 =cut
123  
124 0 ▶sub thumb {
Subroutine thumb: not called CC=3 SCAR=24.8
Pod documented
125 0 my $self = shift;
126 0 my $file = shift;
127 0 ▶ my $smax = shift || 100;
Condition0%0/2
shift() || 100
l!l
00
MC/DC0%0/1
shift() || 100
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
128  
129 0 ▶ return unless($self->{image});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"image"} 0 0 0
130 0 return;
131 }
132  
133 4 1;
134  
135 __END__
« Labyrinth/Plugins.pm ↑ Summary Labyrinth/Constraints.pm »