line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#$ Id: $; |
2
|
|
|
|
|
|
|
package What; |
3
|
2
|
|
|
2
|
|
52050
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
71
|
|
4
|
2
|
|
|
2
|
|
11
|
use vars qw($VERSION); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
103
|
|
5
|
2
|
|
|
2
|
|
808
|
use lib qw(lib); |
|
2
|
|
|
|
|
599
|
|
|
2
|
|
|
|
|
11
|
|
6
|
2
|
|
|
2
|
|
906
|
use What::MTA; |
|
2
|
|
|
|
|
197
|
|
|
2
|
|
|
|
|
5229
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$VERSION = "1.00"; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
What - Find out about running services |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
$what = What->new( |
17
|
|
|
|
|
|
|
Host => my.domain.org, |
18
|
|
|
|
|
|
|
Port => 28, |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
$what->mta; |
22
|
|
|
|
|
|
|
$what->mta_version; |
23
|
|
|
|
|
|
|
$what->mta_banner; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
The What class is interface to classes providing information about |
29
|
|
|
|
|
|
|
running services. What::MTA is the only implementation so far. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 What::MTA |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
MTA's supported are: B, B (version only on localhost), |
34
|
|
|
|
|
|
|
B, B (name only), B, B. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
See L for details. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 METHODS |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=over 4 |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=item new |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$obj = What->new( Host => "10.10.10.1", Port => 25 ) |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item mta() |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Returns the name of the MTA running. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item mta_banner() |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Returns the banner message. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item mta_version() |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Returns the MTA version. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=back |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub new { |
63
|
2
|
|
|
2
|
1
|
983
|
my $self = shift; |
64
|
2
|
|
33
|
|
|
11
|
my $type = ref($self) || $self; |
65
|
2
|
50
|
|
|
|
6
|
if (defined(@_)) { |
66
|
2
|
50
|
33
|
|
|
22
|
my $arg = |
67
|
|
|
|
|
|
|
defined $_[0] && UNIVERSAL::isa($_[0], 'HASH') |
68
|
|
|
|
|
|
|
? shift |
69
|
|
|
|
|
|
|
: { @_ }; |
70
|
2
|
|
|
|
|
10
|
return bless { arg => $arg }, $type; |
71
|
|
|
|
|
|
|
} else { |
72
|
0
|
|
|
|
|
0
|
return bless {}, $type; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub mta { |
77
|
2
|
|
|
2
|
1
|
8
|
my $self = shift; |
78
|
|
|
|
|
|
|
|
79
|
2
|
|
|
|
|
4
|
$self->{what} = What::MTA->new( %{$self->{arg}} ); |
|
2
|
|
|
|
|
19
|
|
80
|
0
|
|
|
|
|
|
return $self->{what}->mta; |
81
|
|
|
|
|
|
|
}; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub mta_version { |
84
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
85
|
0
|
0
|
|
|
|
|
$self->{what} = What::MTA->new( %{$self->{arg}} ) |
|
0
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
unless ref($self->{what}); |
87
|
0
|
|
|
|
|
|
return $self->{what}->mta_version; |
88
|
|
|
|
|
|
|
}; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub mta_banner { |
91
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
92
|
0
|
0
|
|
|
|
|
$self->{what} = What::MTA->new( %{$self->{arg}} ) |
|
0
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
unless ref($self->{what}); |
94
|
0
|
|
|
|
|
|
return $self->{what}->mta_banner; |
95
|
|
|
|
|
|
|
}; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 AUTHOR |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Toni Prug |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 COPYRIGHT |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Copyright (c) 2006. Toni Prug. All rights reserved. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
108
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
109
|
|
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or (at |
110
|
|
|
|
|
|
|
your option) any later version. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but |
113
|
|
|
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of |
114
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
115
|
|
|
|
|
|
|
General Public License for more details. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
118
|
|
|
|
|
|
|
along with this program; if not, write to the Free Software |
119
|
|
|
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
120
|
|
|
|
|
|
|
USA |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
See L |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |