Gnats/Attachment.pm

filter: Statementstmt 67.8% 19 / 28 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 77.7% 7 / 9 Podpod 0.0% 0 / 3 totaltotal 53.0% 26 / 49 CC 4 SCAR 19.9
CC
4
Cov
54%
decode
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 7.3
« Gnats.pm ↑ Summary Gnats/PR.pm »
1 package Net::Gnats::Attachment;
2 40 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 40 ▶use strictures;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 40 ▶use 5.10.00;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 40 ▶use MIME::Base64;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 40 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
8 40 $Net::Gnats::Attachment::VERSION = '0.22';
9 }
10 40 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
13 3 my ($class, %options) = @_;
14 3 my $self = bless \%options, $class;
15 3 return $self;
16 }
17  
18 0 ▶sub encode {
Subroutine encode: not called CC=1 SCAR=0.0
Pod undocumented
19  
20 }
21  
22 0 ▶sub decode {
Subroutine decode: not called CC=4 SCAR=30.0
Pod undocumented
23 0 my ($self) = @_;
24  
25 # Split the envelope from the body.
26 0 my ($envelope, $body) = split(/\n\n/, $self->{payload}, 2);
27 0 ▶ return undef unless ($envelope && $body);
Branch: 1 branch
BranchTrueFalseTotal
unless $envelope and $body 0 0 0
Condition0%0/3
$envelope and $body
!ll&&!rl&&r
000
MC/DC0%0/2
$envelope and $body
$envelope $body
Truth table0%0/3
A and B
A= $envelopeB= $body
ABresult
0X0
100
111
28  
29 0 my $ex_envelope = qr{\sContent-Type:\s(.*)\n
30 \sContent-Transfer-Encoding:\s(.*)\n
31 \sContent-Disposition:\s(.*)\n}x;
32  
33 ($self->{content_type},
34 $self->{content_transfer_encoding},
35 0 $self->{content_disposition}) = $envelope =~ $ex_envelope;
36  
37 0 ▶ if ( $self->{content_transfer_encoding} eq 'base64') {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'content_transfer_encoding'} eq 'base64') { } 0 0 0
38 0 $self->{data} = decode_base64($body);
39 }
40 else {
41 0 $self->{data} = $body;
42 }
43  
44 0 return 1;
45 }
46  
47  
48 40 1;
« Gnats.pm ↑ Summary Gnats/PR.pm »