| 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::POP3; | ||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||
| 13 | 2 | our $VERSION = '1.27'; # VERSION | |||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | 2 | ▶ | use Net::POP3; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 16 | 2 | ▶ | use URI; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||
| 18 | # ====================================================================== | ||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||
| 20 | package SOAP::Transport::POP3::Server; | ||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||
| 22 | 2 | ▶ | use Carp (); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 23 | 2 | ▶ | use vars qw(@ISA $AUTOLOAD); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 24 | 2 | @ISA = qw(SOAP::Server); | |||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | sub DESTROY { my $self = shift; $self->quit if $self->{_pop3server} } | ||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=10 SCAR=47.0
| |||||||||||||||||||||||||||||||||
| 29 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | return $class if ref $class; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||
| 32 | 0 | my $address = shift; | |||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | Carp::carp "URLs without 'pop://' scheme are deprecated. Still continue" | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$address =~ s[^(pop://)?][pop://]i and not $1
MC/DC0%0/2
$address =~ s[^(pop://)?][pop://]i and not $1
$address =~ s[^(pop://)?][pop://]i
not $1
Truth table0%0/3
A and not(B)
A= $address =~ s[^(pop://)?][pop://]iB= not $1
| |||||||||||||||||||||||||||||||||
| 34 | if $address =~ s!^(pop://)?!pop://!i && !$1; | ||||||||||||||||||||||||||||||||
| 35 | 0 | my $server = URI->new($address); | |||||||||||||||||||||||||||||||
| 36 | 0 | my $self = $class->SUPER::new(@_); | |||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | $self->{_pop3server} = Net::POP3->new($server->host_port) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 38 | 0 | or Carp::croak "Can't connect to '@{[$server->host_port]}': $!"; | |||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | my $method = ! $server->auth || $server->auth eq '*' | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
not $server->auth or $server->auth eq "*"
MC/DC0%0/2
not $server->auth or $server->auth eq "*"
not $server->auth
$server->auth eq "*"
Truth table0%0/3
not(A) or B
A= not $server->authB= $server->auth eq "*"
| |||||||||||||||||||||||||||||||||
| 40 | ? 'login' | ||||||||||||||||||||||||||||||||
| 41 | : $server->auth eq '+APOP' | ||||||||||||||||||||||||||||||||
| 42 | ? 'apop' | ||||||||||||||||||||||||||||||||
| 43 | 0 | : Carp::croak "Unsupported authentication scheme '@{[$server->auth]}'"; | |||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | $self->{_pop3server}->$method( split m{:}, $server->user() ) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
defined $server->user && ($self->{'_pop3server'}->$method(split(/:/, $server->user, 0)) || Carp::croak("Can't authenticate to '@{[$server->host_port];}' with '${method}' method"))
$self->{"_pop3server"}->$method(split(/:/, $server->user, 0)) or Carp::croak("Can't authenticate to '@{[$server->host_port];}' with '${method}' method")
MC/DC0%0/2
defined $server->user && ($self->{'_pop3server'}->$method(split(/:/, $server->user, 0)) || Carp::croak("Can't authenticate to '@{[$server->host_port];}' with '${method}' method"))
defined $server->user
$self->{"_pop3server"}->$method(split(/:/, $server->user, 0))
Truth table0%0/3
A && B
A= defined $server->userB= $self->{"_pop3server"}->$method(split(/:/, $server->user, 0))
| |||||||||||||||||||||||||||||||||
| 45 | 0 | or Carp::croak "Can't authenticate to '@{[$server->host_port]}' with '$method' method" | |||||||||||||||||||||||||||||||
| 46 | if defined $server->user; | ||||||||||||||||||||||||||||||||
| 47 | 0 | return $self; | |||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | sub AUTOLOAD { | ||||||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: not called CC=2 SCAR=12.2
| |||||||||||||||||||||||||||||||||
| 51 | 0 | my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::') + 2); | |||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | return if $method eq 'DESTROY'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||
| 54 | 2 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | *$AUTOLOAD = sub { shift->{_pop3server}->$method(@_) }; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 56 | 0 | goto &$AUTOLOAD; | |||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | sub handle { | ||||||||||||||||||||||||||||||
|
Subroutine
handle: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||
| 60 | 0 | my $self = shift->new; | |||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | my $messages = $self->list or return; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 62 | # fixes [ 1.17700 ] POP3 Processes Messages Out of Order | ||||||||||||||||||||||||||||||||
| 63 | 0 | foreach my $msgid (sort { $a <=> $b } (keys(%{$messages}) ) ) { | |||||||||||||||||||||||||||||||
| 64 | # foreach my $msgid (keys %$messages) { | ||||||||||||||||||||||||||||||||
| 65 | 0 | $self->SUPER::handle(join '', @{$self->get($msgid)}); | |||||||||||||||||||||||||||||||
| 66 | } continue { | ||||||||||||||||||||||||||||||||
| 67 | 0 | $self->delete($msgid); | |||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||
| 69 | 0 | return scalar keys %$messages; | |||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | sub make_fault { return } | ||||||||||||||||||||||||||||||
|
Subroutine
make_fault: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||
| 74 | # ====================================================================== | ||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||
| 76 | 2 | 1; | |||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||
| 78 | __END__ | ||||||||||||||||||||||||||||||||