lib/SOAP/Transport/MAILTO.pm

filter: Statementstmt 96.0% 49 / 51 Branchbran 94.4% 17 / 18 Conditioncond 60.0% 6 / 10 MC/DCmcdc 16.6% 1 / 6 Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 87.1% 81 / 93 CC 14 SCAR 17.8
CC
14
Cov
91%
send_receive
9.2
new
6.0
BEGIN
1.0
CRAP 6.0
« lib/SOAP/Packager.pm ↑ Summary lib/SOAP/Transport/IO.pm »
1 # ======================================================================
2 #
3 # Copyright (C) 2000-2001 Paul Kulchenko (paulclinger@yahoo.com)
4 # SOAP::Lite is free software; you can redistribute it
5 # and/or modify it under the same terms as Perl itself.
6 #
7 # ======================================================================
8  
9 package SOAP::Transport::MAILTO;
10  
11 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 our $VERSION = '1.27'; # VERSION
14  
15 2 ▶use MIME::Lite;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 # ======================================================================
19  
20 package SOAP::Transport::MAILTO::Client;
21 1 ▶use SOAP::Lite;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
23 @ISA = qw(SOAP::Client);
24  
25 2 ▶sub DESTROY { SOAP::Trace::objects('()') }
Subroutine DESTROY: called CC=1 SCAR=0.0
26  
27 3 ▶sub new {
Subroutine new: called CC=6 SCAR=17.9
28 3 my $class = shift;
29 3 ▶ return $class if ref $class;
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 1 2 3
30  
31 2 my(@params, @methods);
32 2 ▶ while (@_) { $class->can($_[0]) ? push(@methods, shift() => shift) : push(@params, shift) }
Branch: 2 branches
BranchTrueFalseTotal
if (@_) 11 2 13
$class->can($_[0]) ? : 1 10 11
33 2 my $self = bless {@params} => $class;
34 2 ▶ while (@methods) { my($method, $params) = splice(@methods,0,2);
Branch: 1 branch
BranchTrueFalseTotal
if (@methods) 1 2 3
35 1 ▶ $self->$method(ref $params eq 'ARRAY' ? @$params : $params)
Branch: 1 branch
BranchTrueFalseTotal
ref $params eq 'ARRAY' ? : 0 1 1
36 }
37 2 SOAP::Trace::objects('()');
38  
39 2 return $self;
40 }
41  
42 3 ▶sub send_receive {
Subroutine send_receive: called CC=9 SCAR=22.2
43 3 my($self, %parameters) = @_;
44 my($envelope, $endpoint, $action) =
45 3 @parameters{qw(envelope endpoint action)};
46  
47 3 ▶ $endpoint ||= $self->endpoint;
Condition66%2/3
$endpoint ||= $self->endpoint
l!l&&r!l&&!r
210
MC/DC0%0/2
$endpoint ||= $self->endpoint
$endpoint $self->endpoint
Truth table66%2/3
A ||= B
A= $endpointB= $self->endpoint
ABresult
1X1
011
000
48 3 my $uri = URI->new($endpoint);
49 %parameters = (%$self,
50 0 map {URI::Escape::uri_unescape($_)}
51 0 ▶ map {split/=/,$_,2}
Condition50%1/2
$uri->query || ''
l!l
03
MC/DC0%0/1
$uri->query || ''
$uri->query
Truth table50%1/2
A
A= $uri->query
Aresult
11
00
52 split /[&;]/, $uri->query || '');
53  
54 my $msg = MIME::Lite->new(
55 To => $uri->to,
56 Type => 'text/xml',
57 Encoding => $parameters{Encoding} || 'base64',
58 Data => $envelope,
59 $parameters{From}
60 ? (From => $parameters{From})
61 : (),
62 $parameters{'Reply-To'}
63 ? ('Reply-To' => $parameters{'Reply-To'})
64 : (),
65 $parameters{Subject}
66 ? (Subject => $parameters{Subject})
67 3 ▶ : (),
Branch: 3 branches
BranchTrueFalseTotal
$parameters{'From'} ? : 2 1 3
$parameters{'Reply-To'} ? : 2 1 3
$parameters{'Subject'} ? : 2 1 3
Condition100%2/2
$parameters{'Encoding'} || 'base64'
l!l
21
MC/DC100%1/1
$parameters{'Encoding'} || 'base64'
$parameters{'Encoding'}
Truth table100%2/2
A
A= $parameters{'Encoding'}
Aresult
11
00
68 );
69 3 $msg->replace('X-Mailer' => join '/', 'SOAP::Lite', 'Perl', SOAP::Transport::MAILTO->VERSION);
70 3 $msg->add(SOAPAction => $action);
71  
72 3 SOAP::Trace::transport($msg);
73 3 SOAP::Trace::debug($msg->as_string);
74  
75 3 MIME::Lite->send(map {exists $parameters{$_}
76 6 ▶ ? ($_ => $parameters{$_})
Branch: 1 branch
BranchTrueFalseTotal
exists $parameters{$_} ? : 2 4 6
77 : ()} 'smtp', 'sendmail');
78 3 eval { local $SIG{__DIE__}; $MIME::Lite::AUTO_CC = 0; $msg->send };
79 3 (my $code = $@) =~ s/ at .*\n//;
80  
81 3 $self->code($code);
82 3 $self->message($code);
83 3 ▶ $self->is_success(!defined $code || $code eq '');
Condition33%1/3
!defined($code) || $code eq ''
l!l&&r!l&&!r
030
MC/DC0%0/2
!defined($code) || $code eq ''
!defined($code) $code eq ''
Truth table33%1/3
not(A) || B
A= !defined($code)B= $code eq ''
ABresult
1X1
011
000
84 3 $self->status($code);
85  
86 3 return;
87 }
88  
89 # ======================================================================
90  
91 1;
92  
93 __END__
« lib/SOAP/Packager.pm ↑ Summary lib/SOAP/Transport/IO.pm »