Better @INC fiddling and degenerate case for ProgressTree
This commit is contained in:
parent
f14545ec12
commit
bb8753cd2a
7 changed files with 49 additions and 23 deletions
|
|
@ -97,6 +97,23 @@ sub canView {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 cleanINC(@INC)
|
||||
|
||||
Class method. Returns a new @INC array (but does not set it) to be used for
|
||||
forked/daemonized processes. Note that you pass in @INC and new one is
|
||||
returned, but doesn't replace the original. You must do that yourself.
|
||||
|
||||
=cut
|
||||
|
||||
sub cleanINC {
|
||||
# gotta get rid of hooks until we think of a way to serialize them in
|
||||
# forkAndExec (if we ever want to). Serializing coderefs is a tricky
|
||||
# business.
|
||||
map { File::Spec->rel2abs($_) } grep { !ref } @_;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 contentPairs ($module, $pid, $extra)
|
||||
|
||||
Returns a bit of query string useful for redirecting to a
|
||||
|
|
@ -278,7 +295,7 @@ sub forkAndExec {
|
|||
my $id = $self->getId;
|
||||
my $class = ref $self;
|
||||
my $json = JSON::encode_json($request);
|
||||
my @inc = map {"-I$_"} map { File::Spec->rel2abs($_) } grep { !ref } @INC;
|
||||
my @inc = $class->cleanINC(@INC);
|
||||
my @argv = (@inc, "-M$class", "-e$class->runCmd()" );
|
||||
$class->daemonize(
|
||||
$json,
|
||||
|
|
@ -413,6 +430,7 @@ sub init {
|
|||
$0 = 'webgui-fork-master';
|
||||
$pipe->reader;
|
||||
local $/ = "\x{0}";
|
||||
@INC = $class->cleanINC(@INC);
|
||||
while ( my $request = $pipe->getline ) {
|
||||
chomp $request;
|
||||
eval {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue