App-Acmeman
view release on metacpan or search on metacpan
lib/App/Acmeman/Source/Pound.pm view on Meta::CPAN
package App::Acmeman::Source::Pound;
use strict;
use warnings;
use parent 'App::Acmeman::Source';
use Getopt::Long qw(GetOptionsFromArray :config gnu_getopt no_ignore_case);
use App::Acmeman::Log qw(:all);
use Clone 'clone';
use Data::Dumper;
use constant {
ALT_DEFAULT => 0,
ALT_LISTENER => 1,
ALT_FILE => 2
};
sub new {
my $class = shift;
my $cfgname = '/etc/pound.cfg';
my $host;
my @listener;
my @types;
my $comment;
my $include_dir;
my $altcert = 'default';
GetOptionsFromArray(\@_,
'config|f=s' => \$cfgname,
'host|h=s' => \$host,
'listener=s@' => \@listener,
'type=s@' => \@types,
'comment=s' => \$comment,
'include-dir=s' => \$include_dir,
'alt=s' => \$altcert
);
if ($altcert eq 'default' || $altcert eq 'service') {
$altcert = ALT_DEFAULT;
} elsif ($altcert eq 'listener') {
$altcert = ALT_LISTENER;
} elsif ($altcert eq 'file') {
$altcert = ALT_FILE;
} else {
error("invalid value for --altcert: ignored");
$altcert = ALT_DEFAULT;
}
my $self = bless {
cfgname => $cfgname,
host => $host,
altcert => $altcert,
used_hostnames => {}
}, $class;
if ($comment) {
$self->{comment} = qr($comment)
}
if (@listener) {
$self->{listener} = { map { $_ => 1 } @listener };
}
if (!@types) {
@types = qw(http)
}
$self->{types} = { map { lc($_) => 1 } @types };
if (!$include_dir) {
(undef,$include_dir) = File::Spec->splitpath($cfgname);
}
$self->{include_dir} = $include_dir;
return $self;
}
sub host {
( run in 0.837 second using v1.01-cache-2.11-cpan-c32d3c3b8f1 )