| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# This code is part of Perl distribution Mail-Box-POP3 version 4.01. |
|
2
|
|
|
|
|
|
|
# The POD got stripped from this file by OODoc version 3.05. |
|
3
|
|
|
|
|
|
|
# For contributors see file ChangeLog. |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# This software is copyright (c) 2001-2025 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
|
|
|
|
|
|
|
our $VERSION = '4.01'; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
4
|
|
|
4
|
|
27590
|
use parent 'Exporter'; |
|
|
4
|
|
|
|
|
1517
|
|
|
|
4
|
|
|
|
|
32
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
4
|
|
|
4
|
|
348
|
use strict; |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
161
|
|
|
19
|
4
|
|
|
4
|
|
22
|
use warnings; |
|
|
4
|
|
|
|
|
6
|
|
|
|
4
|
|
|
|
|
225
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
4
|
|
|
4
|
|
2507
|
use Log::Report 'mail-box-pop3'; |
|
|
4
|
|
|
|
|
583037
|
|
|
|
4
|
|
|
|
|
25
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
4
|
|
|
4
|
|
1541
|
use List::Util qw/first/; |
|
|
4
|
|
|
|
|
22
|
|
|
|
4
|
|
|
|
|
321
|
|
|
24
|
4
|
|
|
4
|
|
45
|
use File::Spec (); |
|
|
4
|
|
|
|
|
11
|
|
|
|
4
|
|
|
|
|
80
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
4
|
|
|
4
|
|
2956
|
use Mail::Transport::POP3 (); |
|
|
4
|
|
|
|
|
22
|
|
|
|
4
|
|
|
|
|
1940
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
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
|
|
|
0
|
0
|
|
{ my $popbox = shift; |
|
36
|
0
|
|
0
|
|
|
|
my $setting = 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
|
0
|
|
|
|
|
unless(File::Spec->file_name_is_absolute($perl)) |
|
44
|
0
|
|
|
|
|
|
{ my @path = split /\:|\;/, $ENV{PATH}; |
|
45
|
0
|
|
|
0
|
|
|
$perl = first { -x $_ } map File::Spec->catfile($_, $^X), @path; |
|
|
0
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
$perl =~ m/(.*)/; |
|
49
|
0
|
|
|
|
|
|
$perl = $1; |
|
50
|
0
|
|
|
|
|
|
%ENV = (); |
|
51
|
|
|
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
|
open my $server, "$perl $serverscript $popbox $setting |" |
|
53
|
|
|
|
|
|
|
or fault __x"could not start POP3 test server"; |
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $line = <$server>; |
|
56
|
0
|
0
|
|
|
|
|
my $port = $line =~ m/(\d+)/ ? $1 : error __x"did not get port specification, but '{text}'.", text => $line; |
|
57
|
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
($server, $port); |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# |
|
62
|
|
|
|
|
|
|
# START_POP3_CLIENT PORT, OPTIONS |
|
63
|
|
|
|
|
|
|
# |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub start_pop3_client($@) |
|
66
|
0
|
|
|
0
|
0
|
|
{ my ($port, @options) = @_; |
|
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
|
|
|
|
|
|
|
1; |