Octavian Rasnita wrote: > Thank you, I have done so, but I still have a problem. > > I used to run those config files using do() for getting the data based on a > variable, for example: > > my $ref = do("$language.ini"); > > And depending on the value of the $language variable, it is launched a > different .ini file.
If these are just .ini files, then why don't you use something like Config::Simple to create a object from which to read the data. You could then create a wrapper class that would give access to this object as a singleton. Load the class on server startup and initialize the object there too. As long as you don't change the data it should be stay shared by all of your apache children. > I don't know how to get the variable from a module if I know the name of > that module only at runtime. > > I have tried: > > my $module = "Teddy::ModuleName"; > eval "require $module"; Once you do a 'require' in a process the data is no longer shared between processes. Another request that needs the same configuration data that is handled by a different apache process will need to do the same 'require' thus increasing it's unshared memory, etc. Sometimes this is necessary, but it should be avoided if possible. How many of these language specific configs do you have? Do you know which ones are more likely to be used? If you do then preload as many as possible ahead of time. > But now I don't know how to get the value of $content variable from > Test::ModuleName. > > I know that I can get it using $Teddy::ModuleName::content, but I know the > name of that module only at runtime. > > I have tried $module::content, but it doesn't work. > > Please advice how I can do that. I was trying to get this to work with a hash as the package data, but for some reason it didn't work. But perlref show how to do it with a hashref. my $DATA = $MyConfig::DATA; my $package = $DATA->{'lang_config'}; eval "require $package"; my $LANG_DATA; { no strict 'refs'; $LANG_DATA = ${"${package}::DATA"}; } ==========MyConfig============= package MyConfig; our $DATA = { other => 'MyConfig::Other', }; 1; =========MyConfig::Other======= package MyConfig::Other; our $DATA = { foo => 'more stuff', }; -- Michael Peters Developer Plus Three, LP