1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
|
#
# Courier::Config class
#
# (C) 2003-2008 Julian Mehnle <julian@mehnle.net>
# $Id: Config.pm 210 2008-03-21 19:30:31Z julian $
#
###############################################################################
=head1 NAME
Courier::Config - Class providing configuration information for Perl modules
related to the Courier MTA
=cut
package Courier::Config;
use warnings;
use strict;
use version;
use constant TRUE => (0 == 0);
use constant FALSE => not TRUE;
=head1 SYNOPSIS
use Courier::Config;
# Courier base configuration:
my $config_dir = Courier::Config->config_dir;
my $runtime_dir = Courier::Config->runtime_dir;
my $courier_executable = Courier::Config->courier_executable;
my $courier_version = Courier::Config->courier_version;
# Courier::Filter configuration:
my $filter_conf_file = Courier::Config->filter_conf_file;
=head1 DESCRIPTION
This class provides configuration information for Perl modules related to the
Courier MTA, e.g. installation specific file system paths.
=cut
# Declarations:
###############################################################################
=head2 Courier base configuration
The following methods provide information about Courier's base configuration:
=over
=item B<config_dir>: returns I<string>
The base configuration directory of Courier.
=cut
use constant config_dir => '/etc/courier';
=item B<runtime_dir>: returns I<string>
The directory where Courier keeps the message queue (C<msgq>, C<msgs>, C<tmp>)
and courierfilter sockets (C<filters>, C<allfilters>).
=cut
use constant runtime_dir => '/var/lib/courier'; # Normally '/var/run/courier'.
=item B<courier_executable>: returns I<string>
The full path of the Courier daemon executable.
=cut
use constant courier_executable => '/usr/sbin/courier';
=item B<courier_version>: returns I<version>
The version number of the Courier installation.
=cut
my $courier_version;
sub courier_version {
my ($self) = @_;
my $courier_executable = $self->courier_executable;
if (
not defined($courier_version) and
-x $courier_executable
) {
my $courier_version_string = `$courier_executable --version`;
if (
$? == 0 and
$courier_version_string =~ /^Courier ([^ ]+)/
) {
$courier_version = version->new($1);
}
}
return $courier_version;
}
=back
=head2 Courier::Filter configuration
The following Courier::Filter configuration information is provided:
=over
=item B<filter_conf_file>: returns I<string>
The absolute file name of the Courier::Filter courier-filter-perl configuration
file.
=cut
use constant filter_conf_file => config_dir . '/filters/courier-filter-perl.conf';
=back
=cut
# Support legacy method names:
BEGIN {
no warnings 'once';
*COURIER_CONFIG_DIR = \&config_dir;
*COURIER_RUNTIME_DIR = \&runtime_dir;
*COURIER_FILTER_CONF = \&filter_conf_file;
}
=head1 SEE ALSO
For AVAILABILITY, SUPPORT, and LICENSE information, see
L<Courier::Filter::Overview>.
=head1 AUTHOR
Julian Mehnle <julian@mehnle.net>
=cut
TRUE;
|