in reply to Re^4: OO, Library Configuration and Class Variables
in thread OO, Library Configuration and Class Variables
I wrote an application that has a %config all my modules can access (using Config::IniFile). I created sections for all modules and grab configuration from there.
Config example:
Then your code could be like this:[User] lookup_uri = something
You can also specify which class you want to use for Lookup in config file, and instantiate in User::new.package App; our %config = (); &init; sub init { # loads your configuration file/parameters here and # assigns to %App::config } package User; sub new { my $self = {}; bless $self; $self->{lookup_uri} = $App::config{lookup_uri}; }
Still hope it helps :)
|
|---|