Hi,
I have a server using some Embperl apps with several .pm modules preloaded at server startup time.
While working on new apps that may require enhancements to the public modules, I'd like to be able to use private copies of some of the modules during development, without disturbing the "release" versions of these modules being used by other users of the server.
I've been able to get my Embperl app to load private copies of modules under development by manipulating @INC and %INC at the top of my EmbPerl file:
[.-
local @INC = @INC;
(my $LibDir = $0) =~ s|(.*/).*|$1|;
unshift @INC, $LibDir;
local %INC = %INC;
delete @INC{grep {m/MyDir.*MyModuleName/ } keys %INC};
require MyDir::MyModuleName;
import MyDir::MyModuleName;
-]
... and this does indeed load my private local copy of MyDir::ModuleName. This also has the advantage of forcing reloads of MyDir::MyModuleName on every execution of the Embperl app, which I need when I'm working on the module code.
But the problem with this approach is that it seems the child processes in which this code runs are being told to load my private version of MyDir::MyModuleName, obliterating the public version, so the next person that tries to use the same child process to run a public app is going to find that it's trying to work with the compiled code of my private module rather than the public one.
If this is indeed the case, what is the best solution?
Here are some solutions I can think of:
1) For debugging/development, run a separate apache server
on a separate http port
2) Put the modules in a differently-named directory
during testing
3) Force my app to re-load the public version of the
module after processing my request so the public
version's once again available to subsequent users.
4) Somehow force the child process to terminate itself
after my request.
So this whole question really boils down to:
What's the "official" "best practice" for developing and debugging new versions of modules in an Embperl/Modperl environment while other people are using the old versions?
-c
------------------------------------------------------------------------
870 Market Street #1270 (415) 394-9818
San Francisco, CA 94102 (413) 473-0853 fax
------------------------------------------------------------------------
I have a server using some Embperl apps with several .pm modules preloaded at server startup time.
While working on new apps that may require enhancements to the public modules, I'd like to be able to use private copies of some of the modules during development, without disturbing the "release" versions of these modules being used by other users of the server.
I've been able to get my Embperl app to load private copies of modules under development by manipulating @INC and %INC at the top of my EmbPerl file:
[.-
local @INC = @INC;
(my $LibDir = $0) =~ s|(.*/).*|$1|;
unshift @INC, $LibDir;
local %INC = %INC;
delete @INC{grep {m/MyDir.*MyModuleName/ } keys %INC};
require MyDir::MyModuleName;
import MyDir::MyModuleName;
-]
... and this does indeed load my private local copy of MyDir::ModuleName. This also has the advantage of forcing reloads of MyDir::MyModuleName on every execution of the Embperl app, which I need when I'm working on the module code.
But the problem with this approach is that it seems the child processes in which this code runs are being told to load my private version of MyDir::MyModuleName, obliterating the public version, so the next person that tries to use the same child process to run a public app is going to find that it's trying to work with the compiled code of my private module rather than the public one.
If this is indeed the case, what is the best solution?
Here are some solutions I can think of:
1) For debugging/development, run a separate apache server
on a separate http port
2) Put the modules in a differently-named directory
during testing
3) Force my app to re-load the public version of the
module after processing my request so the public
version's once again available to subsequent users.
4) Somehow force the child process to terminate itself
after my request.
So this whole question really boils down to:
What's the "official" "best practice" for developing and debugging new versions of modules in an Embperl/Modperl environment while other people are using the old versions?
-c
------------------------------------------------------------------------
870 Market Street #1270 (415) 394-9818
San Francisco, CA 94102 (413) 473-0853 fax
------------------------------------------------------------------------