This is to extend my question earlier about modules. Most of the OOP 
concepts are very nicely explained in perlboot kindly pointed out by Japhy 
(thank you!), however I stumbled against a problem. I don't know if I am not 
looking at it correctly, or the idea I want to implement is entirely ill.

The project I am working on get's data from many sources and has to login
here and there. I have a processor engine for each place but so far all the
variables (usernames, passwords, urls, etc)are specified in the
corresponding module. I will have to extend the entire thing pretty soon and
there will be just way too many places to look for variables in case
something needs to change so I decided to create a central Configuration.pm
which will hold different hashes with "configuration sections" e.g.:

package Configuration;

%Configuration::auth = (

    y_stores => {

        'tb' => { 

           name => ....                     
           user => ....
           pass => ....
           sekkey => ....
        },
    },

    mmv => { 

        'tbt => {

           user => ...
           pass => ...
           merchant_num => ...
        },
    },
);


%Configuration::pt_accounts = (

    cc_fees => {

        cash_account => ...
        gateway => ...
        4 => ...
        5 => ...
        6 => ...
        3 => ...
    },
);

.......

You get the idea. Now I am able to access them from Main by doing:

use Configuration;

my $whatever_reference = $Configuration::auth{mmv}{tbt};


however if in main I have another module:

use SomeOther::Module;

then from within this module the same variable returns undef. I suspect I
can not do this since the scopes differ, but I am using fully qualified
variable names. Another way would be to use Configuration in the very same
module, however then Configuration.pm got to reside in the main dir AND a
copy in ./SomeOther/...  I am lost. Is what I am trying to do even right
from a good programming point of view? Probably the total amount of modules
accessing these Configuration variables will be around 10. I would highly
appreciate any input on this.

Thank you 

Peter

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to