perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robin Berjon <ro...@knowscape.com>
Subject Re: [OT] Dynamically changing current package
Date Thu, 01 Feb 2001 09:18:43 GMT
At 23:20 31/01/2001 -0800, Andrew Ho wrote:
>AH>This isn't strictly a mod_perl question, but is there a good way in
>AH>general Perl to dynamically change the current package name?
>
>GED>perldoc -f package
>
>I know how to use "package" in the normal case, where it's static.
>However, you can't say "package $foo" or even "eval 'package foo'" or even
>"BEGIN { eval 'package foo' }." I'm wondering if there's any way short of
>hacking the Perl source itself to make the compiler dynamically choose a
>namespace.

I guess you could copy everything you have that you need in that package
there (using aliases probably) and then goto &sub there (making the sub in
that package think it was called by your caller) but I don't really see the
point of that. Perhaps if you told us what is the problem that you think
you can solve by switching your package we'd be able to suggest more
appropriate solutions.

-- robin b.
"Chance is irrelevant. We will succeed." -- 7o9


Mime
View raw message