Hi!

Strictly speaking this has nothing to do with mod_perl, I just got
into that problem writing mod_perl application. I want some module
to decide its namespace at loading time. Obviously it can be solved
with one big eval over entire module text, but this is not an option
in my case - the code have to be just a couple of lines at the top
of a module file.

Is there any way to tell perl that from now on the namespace is
$namespace? `package' does not accept scalars, and its scope is
eval block, so if I use eval to pass scalar to "package" I have to
include entire program text into that eval as well.

Here is an example of what I need:

blahblahblah.pm:

  my $namespace="Blah::Blah::Blah";

  something_that_sets_namespace($namespace);

  sub test ()
  { print "I'm in package: ", __PACKAGE__, "\n";
  }

  1;

Any ideas? Is it possible at all?

Andrew.

Reply via email to