--- Hakan Aksu <[EMAIL PROTECTED]> wrote:
> thanks for the response.
> However my problem is not calling the variables. but calling the module.
> 
> Let says I have this directory structure :
> 
> ~myapp/class1/foo.pm
> ~myapp/class2/foo.pm
> ~myapp/class3/foo.pm
> 
> and my @INC  has "~myapp/"
> 
> I want to call  :
> use   class?::foo;   #dynamic
> where class? is the variable..

You want to use a variable for a module name.  While it's not the same as using a 
variable for a
variable name, I think it's related.  Here's a series of articles which explain in 
depth why this
is not a good idea:

http://perl.plover.com/varvarname.html
http://perl.plover.com/varvarname2.html
http://perl.plover.com/varvarname3.html

Since 'use' works at compile time and 'require' works at runtime, maybe this is the 
way to go?

require class1::foo if $somevar == 1;
require class2::foo if $somevar == 2;
require class3::foo if $somevar == 3;

Cheers,
Curtis Poe

=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Reply via email to