in reply to Re: Packaging up my code sensibly
in thread Packaging up my code sensibly

Thanks for the reply. Your linked thread is quite specific to CGI::App, and while I learned a little bit from it, I am still in the confused land.

Wrt reading a conf file, that is not really a problem. I am already reading an external conf file. I can also use Config::Simple or its many other brethren. However, the problem more is how to share these values among the various imported modules. I guess, that is really what I need a tutorial on.

I am not really share my H::T objects right now. I have only one module MyPackage.pm that I bring in. I create an H::T object in it. However, if I chop up MyPackage.pm into many sub-packages, I will have to schlep H::T object back and forth. I am not quite sure how to do that correctly.

--

when small people start casting long shadows, it is time to go to bed

Replies are listed 'Best First'.
Re^3: Packaging up my code sensibly
by wazoox (Prior) on Jun 13, 2005 at 10:19 UTC
    Isn't what you need is a singleton object to store your values? Something that you'll call like this :
    use MyModules::Config; # here's the singleton magic: # "new" recalls the existing instance if any. my $conf=Config->new();
    from each script. And the Config package would look like this : This way, all your modules can share the same config without passing any parameter around : just call my $conf=Config->new() from each module, the first to call it will load the configuration data, the others will simply share that instance.