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  
14 our $VERSION = 1.17;
15  
16 2 ▶use MIME::Lite;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 # ======================================================================
20  
21 package SOAP::Transport::MAILTO::Client;
22 1 ▶use SOAP::Lite;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
24 @ISA = qw(SOAP::Client);
25  
26 2 ▶sub DESTROY { SOAP::Trace::objects('()') }
Subroutine DESTROY: called CC=1 SCAR=0.0
27  
28 sub new {
29 3 ▶ my $class = shift;
Subroutine new: called CC=6 SCAR=17.9
30 3 ▶ return $class if ref $class;
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 1 2 3
31  
32 2 my(@params, @methods);
33 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
34 2 my $self = bless {@params} => $class;
35 2 ▶ while (@methods) { my($method, $params) = splice(@methods,0,2);
Branch: 1 branch
BranchTrueFalseTotal
if (@methods) 1 2 3
36 1 ▶ $self->$method(ref $params eq 'ARRAY' ? @$params : $params)
Branch: 1 branch
BranchTrueFalseTotal
ref $params eq 'ARRAY' ? : 0 1 1
37 }
38 2 SOAP::Trace::objects('()');
39  
40 2 return $self;
41 }
42  
43 sub send_receive {
44 3 ▶ my($self, %parameters) = @_;
Subroutine send_receive: called CC=9 SCAR=22.2
45 my($envelope, $endpoint, $action) =
46 3 @parameters{qw(envelope endpoint action)};
47  
48 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
49 3 my $uri = URI->new($endpoint);
50 %parameters = (%$self,
51 0 map {URI::Escape::uri_unescape($_)}
52 3 ▶ 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
53 split /[&;]/, $uri->query || '');
54  
55 my $msg = MIME::Lite->new(
56 To => $uri->to,
57 Type => 'text/xml',
58 Encoding => $parameters{Encoding} || 'base64',
59 Data => $envelope,
60 $parameters{From}
61 ? (From => $parameters{From})
62 : (),
63 $parameters{'Reply-To'}
64 ? ('Reply-To' => $parameters{'Reply-To'})
65 : (),
66 $parameters{Subject}
67 ? (Subject => $parameters{Subject})
68 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
69 );
70 3 $msg->replace('X-Mailer' => join '/', 'SOAP::Lite', 'Perl', SOAP::Transport::MAILTO->VERSION);
71 3 $msg->add(SOAPAction => $action);
72  
73 3 SOAP::Trace::transport($msg);
74 3 SOAP::Trace::debug($msg->as_string);
75  
76 3 MIME::Lite->send(map {exists $parameters{$_}
77 6 ▶ ? ($_ => $parameters{$_})
Branch: 1 branch
BranchTrueFalseTotal
exists $parameters{$_} ? : 2 4 6
78 : ()} 'smtp', 'sendmail');
79 3 eval { local $SIG{__DIE__}; $MIME::Lite::AUTO_CC = 0; $msg->send };
80 3 (my $code = $@) =~ s/ at .*\n//;
81  
82 3 $self->code($code);
83 3 $self->message($code);
84 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
85 3 $self->status($code);
86  
87 3 return;
88 }
89  
90 # ======================================================================
91  
92 1;
93  
94 __END__
« lib/SOAP/Packager.pm ↑ Summary lib/SOAP/Transport/IO.pm »