Apacheのapachectlの結果がperlからとれないの

/usr/local/httpd2/bin/apachectl configtest
なconfigtestな結果をperl
単純に``でくくるとかパイプかませてみたりしてもSyntax OKとかを取得できなかった。
/usr/local/httpd2/bin/httpd -tでも童謡だ。
なのでServer::Control::Apacheを入れてみた。

    use Server::Control::Apache;

    my $apache = Server::Control::Apache->new(
        server_root  => '/my/apache/dir'
       # OR    
        conf_file => '/my/apache/dir/conf/httpd.conf'
    );
    if ( !$apache->is_running() ) {
        $apache->start();
    }

プラグインも簡単につくれるよう
For example, here is a role that sends an email whenever a server is successfully started or stopped:

   package Server::Control::Plugin::EmailOnStatusChange;
   use Moose::Role;
   
   has 'email_status_to' => ( is => 'ro', isa => 'Str', required => 1 );
   
   after 'successful_start' => sub {
       shift->send_email("server started");
   };
   after 'successful_stop' => sub {
       shift->send_email("server stopped");
   };
   
   __PACKAGE__->meta->make_immutable();
   
   sub send_email {
       my ( $self, $subject ) = @_;
   
       ...;
   }
   
   1;