blahblah has asked for the wisdom of the Perl Monks concerning the following question:
I know soft-references are bad and I am very open to other suggestions. I am also open to other ways to use dynamically loaded code without collisions. The reason I didn't put the package declaration in the code being loaded is because then I wouldn't know the name of the namespace for that code. Thanks, alex# just a quick simplified version my $package = "Foo"; loader(); sub loader { eval {"package $package"}; require "$package"; # assume $package is in @INC } # now I need to address variables in Foo::, # but I painted myself into a corner where the # only thing I can think of is soft references - # a Bad Thing. print $$package::somehash{somevalue}; # to really have fun I was also trying to run subs # that existed in Foo:: my $action = "testfoo"; &{"$$package::actionshash{$Main::action}"};
|
|---|