| 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
| |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 2 | my(@params, @methods); | |||||||||||||||||||||||||||
| 32 | 2 | ▶ | while (@_) { $class->can($_[0]) ? push(@methods, shift() => shift) : push(@params, shift) } | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 33 | 2 | my $self = bless {@params} => $class; | |||||||||||||||||||||||||||
| 34 | 2 | ▶ | while (@methods) { my($method, $params) = splice(@methods,0,2); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 1 | ▶ | $self->$method(ref $params eq 'ARRAY' ? @$params : $params) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
MC/DC0%0/2
$endpoint ||= $self->endpoint
$endpoint
$self->endpoint
Truth table66%2/3
A ||= B
A= $endpointB= $self->endpoint
| |||||||||||||||||||||||||||||
| 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 || ''
MC/DC0%0/1
$uri->query || ''
$uri->query
Truth table50%1/2
A
A= $uri->query
| |||||||||||||||||||||||||||||
| 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
Condition100%2/2
$parameters{'Encoding'} || 'base64'
MC/DC100%1/1
$parameters{'Encoding'} || 'base64'
$parameters{'Encoding'}
Truth table100%2/2
A
A= $parameters{'Encoding'}
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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 ''
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 ''
| |||||||||||||||||||||||||||||
| 84 | 3 | $self->status($code); | |||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 3 | return; | |||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | # ====================================================================== | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | 1; | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | __END__ | ||||||||||||||||||||||||||||