On 2015-09-23 03:36:14, COUDOT wrote:
Show quoted text> Le Mar 22 Sep 2015 16:08:29, SREZIC a écrit :
> > On 2015-09-22 11:40:59, COUDOT wrote:
> > > I tried to replace 'perl' by $^X but as we are under mod_perl2, $^X
> > > is
> > > equivalent to /usr/bin/apache2, so it does not work.
> > >
> > > Do you have another idea on how to fix the tests?
> >
> > One possibility is to use $Config{perlpath}, which is almost always
> > the same as $^X.
> > I also think that mod_perl defines something which can be checked
> > (was
> > it $ENV{MOD_PERL}?)
>
>
> The %Config is not defined in our environment (is this mod_perl 1 ?)
You need to say "use Config" before.
Show quoted text> I just pushed this patch:
>
> @@ -175,7 +175,8 @@ sub statusProcess {
> open STDOUT, ">&$fdout";
> my @tmp = ();
> push @tmp, "-I$_" foreach (@INC);
> - exec 'perl', '-MLemonldap::NG::Handler::Status',
> + my $perl_exec = ( $^X =~ /perl/ ) ? $^X : 'perl';
> + exec $perl_exec, '-MLemonldap::NG::Handler::Status',
> @tmp,
> '-e',
> '&Lemonldap::NG::Handler::Status::run('
>
>
> Unit tests are ok on my laptop, hope this will work when we will
> update the module on CPAN.
To be extra safe you could check that only the basename contains the string perl, something like this (untested):
use File::Basename qw(basename);
my $perl_exec = ( basename($^X) =~ /perl/ ) ? $^X : 'perl';
Otherwise your intention could fail if you have an apache in an unusual path like /opt/perl/bin/httpd or so...