On Fri, 2007-04-27 at 10:19 +0200, Clinton Gormley wrote:
> On Fri, 2007-04-27 at 09:43 +0200, Alicia Amadoz wrote:
> > Hi,
> >
>
> > [error] \n------------- EXCEPTION: Bio::Root::Exception
> > -------------\nMSG: Can't locate Apache/SubProcess.pm in @INC (....)\n
> > BEGIN failed--compilation aborted at (eval 47) line
> > 2.\n\nApache::SubProcess module required for running under
> > mod_perl\nSTACK: Error::throw\nSTACK: Bio::Root::Root::throw ...
>
> The error is that it can't locate Apache::SubProcess, but you're using
> mod_perl 2, which uses Apache2::Subprocess.
>
>
> Clint
I'm not familiar with bioperl, but doing a code search, it seems that
Bio::DB::WebDBSeql has just (v 1.5.2) added the dependency on
Apache::SubProcess, but purely as a way of cleaning up the environment
after forking:
http://doc.bioperl.org/releases/bioperl-1.5.2/Bio/DB/WebDBSeqI.html#CODE25
----------------------------------------------------------------
sub _open_pipe {
my ($self) = @_;
if($ENV{MOD_PERL} and ! our $loaded_apache_sp) {
eval 'use Apache::SubProcess';
$@ and $self->throw("suppressed::SubProcess module required for running under mod_perl");
$loaded_apache_sp = 1;
}
my $pipe = IO::Pipe->new();
$SIG{CHLD} = 'IGNORE';
defined(my $pid = fork)
or $self->throw("Couldn't fork: $!");
unless($pid) {
#CHILD
$pipe->writer();
#if we're running under mod_perl, clean up some things after this fork
if ($ENV{MOD_PERL} and my $r = eval{Apache->request} ) {
$r->cleanup_for_exec;
#don't read or write the mod_perl parent's tied filehandles
close STDIN; close STDOUT;
setsid() or $self->throw('Could not detach from parent');
}
} else {
#PARENT
$pipe->reader();
}
return ( $pid, $pipe );
}
----------------------------------------------------------------
In mod_perl 2, cleanup_for_exec is no longer required:
http://perl.apache.org/docs/2.0/user/porting/compat.html#C__r_E_gt_cleanup_for_exec_
So, you could probably just do this (warning : untested) :
----------------------------------------------------------------
my $MP1 = $ENV{MOD_PERL}
&& ! (exists $ENV{MOD_PERL_API_VERSION} and
$ENV{MOD_PERL_API_VERSION} >= 2);
sub _open_pipe {
my ($self) = @_;
if($MP1! our $loaded_apache_sp) {
eval 'use Apache::SubProcess';
$@ and $self->throw("suppressed::SubProcess module required for running under mod_perl");
$loaded_apache_sp = 1;
}
my $pipe = IO::Pipe->new();
$SIG{CHLD} = 'IGNORE';
defined(my $pid = fork)
or $self->throw("Couldn't fork: $!");
unless($pid) {
#CHILD
$pipe->writer();
#if we're running under mod_perl, clean up some things after this fork
if ($MP1 and my $r = eval{Apache->request} ) {
$r->cleanup_for_exec;
#don't read or write the mod_perl parent's tied filehandles
close STDIN; close STDOUT;
setsid() or $self->throw('Could not detach from parent');
}
} else {
#PARENT
$pipe->reader();
}
return ( $pid, $pipe );
}
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.