line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Server::Mail::ESMTP::HELP; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
32152
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
264
|
|
4
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
50
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use base qw(Net::Server::Mail::ESMTP::Extension); |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
1999
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Net::Server::Mail::ESMTP::HELP - Simple implementation of HELP for Net::Server::Mail::ESMTP |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Version 0.01 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Simple implementation of HELP for Net::Server::Mail::ESMTP. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use Net::Server::Mail::ESMTP; |
26
|
|
|
|
|
|
|
my $server = new IO::Socket::INET Listen => 1, LocalPort => 25; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $conn; |
29
|
|
|
|
|
|
|
while($conn = $server->accept) |
30
|
|
|
|
|
|
|
{ |
31
|
|
|
|
|
|
|
my $esmtp = new Net::Server::Mail::ESMTP socket => $conn; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# activate HELP extension |
34
|
|
|
|
|
|
|
$esmtp->register('Net::Server::Mail::ESMTP::HELP'); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# adding (optional) HELP handler |
37
|
|
|
|
|
|
|
$esmtp->set_callback(HELP => \&show_help); |
38
|
|
|
|
|
|
|
$esmtp->process; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# if you don't set a custom HELP handler, the default one will be used which just lists all known verbs |
42
|
|
|
|
|
|
|
sub show_help { |
43
|
|
|
|
|
|
|
my ($session, $command) = @_; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
$session->reply(214, ($command ? "2.0.0 Heck yeah, '$command' rules!\n":'') . "2.0.0 Available Commands: " . join(', ', keys %{$session->{verb}}) . "\nEnd of HELP info"); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
return 1; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 EXPORT |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
A list of functions that can be exported. You can delete this section |
55
|
|
|
|
|
|
|
if you don't export anything, such as for a purely object-oriented module. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 FUNCTIONS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 verb |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub verb { |
66
|
0
|
|
|
0
|
1
|
|
return [ 'HELP' => 'help' ]; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 keyword |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub keyword { |
74
|
0
|
|
|
0
|
1
|
|
return 'HELP'; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 reply |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub reply { |
82
|
0
|
|
|
0
|
1
|
|
return ( [ 'HELP', ] ); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 help |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub help { |
90
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
91
|
0
|
|
|
|
|
|
my ($args) = @_; |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
my $ref = $self->{callback}->{HELP}; |
94
|
0
|
0
|
0
|
|
|
|
if ( ref $ref eq 'ARRAY' && ref $ref->[0] eq 'CODE' ) { |
95
|
0
|
|
|
|
|
|
my $code = $ref->[0]; |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
my $ok = &$code($self, $args); |
98
|
|
|
|
|
|
|
} else { |
99
|
0
|
|
|
|
|
|
$self->reply(214, "2.0.0 Available Commands: " . join(', ', keys %{$self->{verb}}) . "\nEnd of HELP info"); |
|
0
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
return (); |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
*Net::Server::Mail::ESMTP::help = \&help; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 AUTHOR |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Dan Moore, C<< >> |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 BUGS |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
115
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
116
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 SUPPORT |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
perldoc Net::Server::Mail::ESMTP::HELP |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
You can also look for information at: |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=over 4 |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
L |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
L |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=item * CPAN Ratings |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
L |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item * Search CPAN |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
L |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=back |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Copyright 2011 Dan Moore. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
159
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
160
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=cut |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
1; # End of Net::Server::Mail::ESMTP::HELP |