diff options
Diffstat (limited to 'lib/App/Acmeman/Apache/Layout.pm')
-rw-r--r-- | lib/App/Acmeman/Apache/Layout.pm | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/lib/App/Acmeman/Apache/Layout.pm b/lib/App/Acmeman/Apache/Layout.pm index 7b9ec9d..1f2027c 100644 --- a/lib/App/Acmeman/Apache/Layout.pm +++ b/lib/App/Acmeman/Apache/Layout.pm @@ -106,6 +106,43 @@ sub new { sub apache { shift->{_defaults} } +sub apache_modules { + my $self = shift; + + if (@_ == 1 && !defined $_[0]) { + delete $self->{apache_modules}; + shift; + } + unless ($self->{apache_modules}) { + if (open(my $fd, '-|', + $self->server_command, '-t', '-D', 'DUMP_MODULES')) { + while (<$fd>) { + chomp; + if (/^\s+(\w+)_module\s+\((static|shared)\)$/) { + $self->{apache_modules}{$1} = $2; + } + } + close $fd; + } else { + croak "can't run ".$self->server_command.": $!"; + } + } + my %ret; + if (@_) { + foreach my $m (@_) { + $ret{$m} = $self->{apache_modules}{$m} + if exists $self->{apache_modules}{$m}; + } + } else { + %ret = %{$self->{apache_modules}}; + } + if (wantarray) { + return %ret; + } else { + return keys %ret; + } +} + sub name { my $self = shift; unless ($self->{layout_name}) { @@ -142,10 +179,11 @@ sub restart_command { return $self->{restart_command}; } +sub pre_setup {} sub post_setup {} package App::Acmeman::Apache::Layout::auto; -use parent 'App::Acmeman::Apache::Layout'; +my @ISA = qw(App::Acmeman::Apache::Layout); use App::Acmeman::Log qw(:all); sub new { |