| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# Copyrights 2001-2018 by [Mark Overmeer]. |
|
2
|
|
|
|
|
|
|
# For other contributors see ChangeLog. |
|
3
|
|
|
|
|
|
|
# See the manual pages for details on the licensing terms. |
|
4
|
|
|
|
|
|
|
# Pod stripped from pm file by OODoc 2.02. |
|
5
|
|
|
|
|
|
|
# This code is part of distribution Mail-Box-POP3. Meta-POD processed with |
|
6
|
|
|
|
|
|
|
# OODoc into POD and HTML manual-pages. See README.md |
|
7
|
|
|
|
|
|
|
# Copyright Mark Overmeer. Licensed under the same terms as Perl itself. |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package Mail::Box::POP3::Test; |
|
10
|
4
|
|
|
4
|
|
1513
|
use vars '$VERSION'; |
|
|
4
|
|
|
|
|
32
|
|
|
|
4
|
|
|
|
|
233
|
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.004'; |
|
12
|
|
|
|
|
|
|
|
|
13
|
4
|
|
|
4
|
|
20
|
use base 'Exporter'; |
|
|
4
|
|
|
|
|
4
|
|
|
|
4
|
|
|
|
|
393
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
4
|
|
|
4
|
|
18
|
use strict; |
|
|
4
|
|
|
|
|
6
|
|
|
|
4
|
|
|
|
|
96
|
|
|
16
|
4
|
|
|
4
|
|
15
|
use warnings; |
|
|
4
|
|
|
|
|
7
|
|
|
|
4
|
|
|
|
|
76
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
4
|
|
|
4
|
|
1402
|
use Mail::Transport::POP3; |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
115
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
4
|
|
|
4
|
|
22
|
use List::Util 'first'; |
|
|
4
|
|
|
|
|
5
|
|
|
|
4
|
|
|
|
|
312
|
|
|
21
|
4
|
|
|
4
|
|
23
|
use File::Spec; |
|
|
4
|
|
|
|
|
5
|
|
|
|
4
|
|
|
|
|
1166
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our @EXPORT = qw/start_pop3_server start_pop3_client/; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# |
|
26
|
|
|
|
|
|
|
# Start POP3 server for tests |
|
27
|
|
|
|
|
|
|
# |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub start_pop3_server($;$) |
|
30
|
0
|
|
|
0
|
0
|
|
{ my $popbox = shift; |
|
31
|
0
|
|
0
|
|
|
|
my $setting = shift || ''; |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my $serverscript = File::Spec->catfile('t', 'server'); |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# Some complications to find-out $perl, which must be absolute and |
|
36
|
|
|
|
|
|
|
# untainted for perl5.6.1, but not for the other Perl's. |
|
37
|
0
|
|
|
|
|
|
my $perl = $^X; |
|
38
|
0
|
0
|
|
|
|
|
unless(File::Spec->file_name_is_absolute($perl)) |
|
39
|
0
|
|
|
|
|
|
{ my @path = split /\:|\;/, $ENV{PATH}; |
|
40
|
0
|
|
|
0
|
|
|
$perl = first { -x $_ } |
|
41
|
0
|
|
|
|
|
|
map { File::Spec->catfile($_, $^X) } |
|
|
0
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
@path; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
$perl =~ m/(.*)/; |
|
46
|
0
|
|
|
|
|
|
$perl = $1; |
|
47
|
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
%ENV = (); |
|
49
|
|
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
|
open(my $server, "$perl $serverscript $popbox $setting|") |
|
51
|
|
|
|
|
|
|
or die "Could not start POP3 server\n"; |
|
52
|
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
my $line = <$server>; |
|
54
|
0
|
0
|
|
|
|
|
my $port = $line =~ m/(\d+)/ ? $1 |
|
55
|
|
|
|
|
|
|
: die "Did not get port specification, but '$line'"; |
|
56
|
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
($server, $port); |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# |
|
61
|
|
|
|
|
|
|
# START_POP3_CLIENT PORT, OPTIONS |
|
62
|
|
|
|
|
|
|
# |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub start_pop3_client($@) |
|
65
|
0
|
|
|
0
|
0
|
|
{ my ($port, @options) = @_; |
|
66
|
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
Mail::Transport::POP3->new |
|
68
|
|
|
|
|
|
|
( hostname => '127.0.0.1' |
|
69
|
|
|
|
|
|
|
, port => $port |
|
70
|
|
|
|
|
|
|
, username => 'user' |
|
71
|
|
|
|
|
|
|
, password => 'password' |
|
72
|
|
|
|
|
|
|
, @options |
|
73
|
|
|
|
|
|
|
); |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |