line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SMTP::Server; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require 5.001; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
710
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
6
|
1
|
|
|
1
|
|
4
|
use vars qw($VERSION @ISA @EXPORT); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
123
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require Exporter; |
9
|
|
|
|
|
|
|
require AutoLoader; |
10
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
85
|
|
11
|
1
|
|
|
1
|
|
932
|
use IO::Socket; |
|
1
|
|
|
|
|
1074785
|
|
|
1
|
|
|
|
|
5
|
|
12
|
1
|
|
|
1
|
|
2941
|
use Sys::Hostname; |
|
1
|
|
|
|
|
1613
|
|
|
1
|
|
|
|
|
462
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
@ISA = qw(Exporter AutoLoader); |
15
|
|
|
|
|
|
|
@EXPORT = qw(); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$VERSION = '1.0'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub new { |
20
|
0
|
|
|
0
|
0
|
|
my $this = shift; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
0
|
|
|
|
my $class = ref($this) || $this; |
23
|
0
|
|
|
|
|
|
my $self = {}; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
$self->{HOST} = shift; |
26
|
0
|
|
|
|
|
|
$self->{PORT} = shift; |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
bless($self, $class); |
29
|
|
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
|
$self->{HOST} = hostname unless defined($self->{HOST}); |
31
|
0
|
0
|
|
|
|
|
$self->{PORT} = 25 unless defined($self->{PORT}); |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
$self->{SOCK} = IO::Socket::INET->new(Proto => 'tcp', |
34
|
|
|
|
|
|
|
LocalAddr => $self->{HOST}, |
35
|
|
|
|
|
|
|
LocalPort => $self->{PORT}, |
36
|
|
|
|
|
|
|
Listen => SOMAXCONN, |
37
|
|
|
|
|
|
|
Reuse => 1); |
38
|
|
|
|
|
|
|
|
39
|
0
|
0
|
|
|
|
|
return defined($self->{SOCK}) ? $self : undef; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub accept { |
43
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
44
|
0
|
|
|
|
|
|
my $client; |
45
|
|
|
|
|
|
|
|
46
|
0
|
0
|
|
|
|
|
if($client = $self->{SOCK}->accept()) { |
47
|
0
|
|
|
|
|
|
$self->{SOCK}->autoflush(1); |
48
|
0
|
|
|
|
|
|
return $client; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
return undef; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub DESTROY { |
55
|
0
|
|
|
0
|
|
|
shift->{SOCK}->close; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
__END__ |