| 1 | # This code is part of Perl distribution Mail-Box-POP3 version 4.02. | ||||||||||||
| 2 | # The POD got stripped from this file by OODoc version 3.06. | ||||||||||||
| 3 | # For contributors see file ChangeLog. | ||||||||||||
| 4 | |||||||||||||
| 5 | # This software is copyright (c) 2001-2026 by Mark Overmeer. | ||||||||||||
| 6 | |||||||||||||
| 7 | # This is free software; you can redistribute it and/or modify it under | ||||||||||||
| 8 | # the same terms as the Perl 5 programming language system itself. | ||||||||||||
| 9 | # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later | ||||||||||||
| 10 | |||||||||||||
| 11 | |||||||||||||
| 12 | package Mail::Box::POP3::Test;{ | ||||||||||||
| 13 | 4 | our $VERSION = '4.02'; | |||||||||||
| 14 | } | ||||||||||||
| 15 | |||||||||||||
| 16 | 4 | ▶ | use parent 'Exporter'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 17 | |||||||||||||
| 18 | 4 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 19 | 4 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 20 | |||||||||||||
| 21 | 4 | ▶ | use Log::Report 'mail-box-pop3'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 22 | |||||||||||||
| 23 | 4 | ▶ | use List::Util qw/first/; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 24 | 4 | ▶ | use File::Spec (); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 25 | |||||||||||||
| 26 | 4 | ▶ | use Mail::Transport::POP3 (); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 27 | |||||||||||||
| 28 | 4 | our @EXPORT = qw/start_pop3_server start_pop3_client/; | |||||||||||
| 29 | |||||||||||||
| 30 | # | ||||||||||||
| 31 | # Start POP3 server for tests | ||||||||||||
| 32 | # | ||||||||||||
| 33 | |||||||||||||
| 34 | sub start_pop3_server($;$) | ||||||||||||
| 35 | 0 | ▶ | { my $popbox = shift; | ||||||||||
|
Subroutine
start_pop3_server: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||
| 36 | 0 | ▶ | my $setting = shift || ''; | ||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||
| 37 | |||||||||||||
| 38 | 0 | my $serverscript = File::Spec->catfile('t', 'server'); | |||||||||||
| 39 | |||||||||||||
| 40 | # Some complications to find-out $perl, which must be absolute and | ||||||||||||
| 41 | # untainted for perl5.6.1, but not for the other Perl's. | ||||||||||||
| 42 | 0 | my $perl = $^X; | |||||||||||
| 43 | 0 | ▶ | unless(File::Spec->file_name_is_absolute($perl)) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 44 | 0 | { my @path = split /\:|\;/, $ENV{PATH}; | |||||||||||
| 45 | 0 | ▶ | $perl = first { -x $_ } map File::Spec->catfile($_, $^X), @path; | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 46 | } | ||||||||||||
| 47 | |||||||||||||
| 48 | 0 | $perl =~ m/(.*)/; | |||||||||||
| 49 | 0 | $perl = $1; | |||||||||||
| 50 | 0 | %ENV = (); | |||||||||||
| 51 | |||||||||||||
| 52 | 0 | ▶ | open my $server, "$perl $serverscript $popbox $setting |" | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 53 | or fault __x"could not start POP3 test server"; | ||||||||||||
| 54 | |||||||||||||
| 55 | 0 | my $line = <$server>; | |||||||||||
| 56 | 0 | ▶ | my $port = $line =~ m/(\d+)/ ? $1 : error __x"did not get port specification, but '{text}'.", text => $line; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 57 | |||||||||||||
| 58 | 0 | ($server, $port); | |||||||||||
| 59 | } | ||||||||||||
| 60 | |||||||||||||
| 61 | # | ||||||||||||
| 62 | # START_POP3_CLIENT PORT, OPTIONS | ||||||||||||
| 63 | # | ||||||||||||
| 64 | |||||||||||||
| 65 | sub start_pop3_client($@) | ||||||||||||
| 66 | 0 | ▶ | { my ($port, @options) = @_; | ||||||||||
|
Subroutine
start_pop3_client: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 67 | |||||||||||||
| 68 | 0 | Mail::Transport::POP3->new( | |||||||||||
| 69 | hostname => '127.0.0.1', | ||||||||||||
| 70 | port => $port, | ||||||||||||
| 71 | username => 'user', | ||||||||||||
| 72 | password => 'password', | ||||||||||||
| 73 | @options, | ||||||||||||
| 74 | ); | ||||||||||||
| 75 | } | ||||||||||||
| 76 | |||||||||||||
| 77 | 4 | 1; | |||||||||||