--- Mark Fuller <[EMAIL PROTECTED]> wrote: > On Sun, Mar 16, 2008 at 4:31 PM, James.Q.L <[EMAIL PROTECTED]> wrote: > > > >I store ONLY $uuid in param because i need it in other controller. i > am passing $dbh to > >Company:: modules because these modules are not inherited from C::A. > > The example your provided showed them being passed as parameters to > $self->methods() which have access to the param method.. > > If you're passing them to true subroutines (not methods) there's no > way around that except to begin refactoring your code into objects. > That's the problem I had a few years ago and found myself bundling > things into one hash which could be passed around (a lot like an > object). Or, creating modules to hold the data belonging to that > namespace within that namespace (a lot like an object). And then, > voila!, a module with a hash (an object).
i would like to an example of this. > > > i like to define $uuid, > > I might be missing the point, but what's wrong with storing $uuid in > Company::Util as an "our" variable and accessing it from anywhere as > $Company::Util::uuid ? > correct me if i am wrong. that won't work under mod_perl. because our $uuid is a global package variable and shared by all instances. > I'm not sure that's the right thing to do. But, it's what you're > asking for. If you're going through what I did, once you do that I bet > you proceed to an object. Or, making your subroutines methods. > > Maybe you should post a different example? It sounds like the one you > posted didn't represent the problem you're having? > what i want is to setup $uuid and $dbh for the Company:: modules so that i can do use base 'CGI::Application'; use Company::CAP::EventLogging; # a plugin for CGI::Application sub cgiapp_init { # init Company::Base $company = Company::Base->new(); $company->dbh( MyApp::DB->dbh ); $company->user($ENV{REMOTE_USER}); # then somehow all my Company:: can start to use the $dbh etc.. } sub method { shift->elog("log this"); } this is probably more of a OO design and mod_perl related question.. probably i better seek help from perlmonk or mod_perl list.. > Mark thanks, James. ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ ##### CGI::Application community mailing list ################ ## ## ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp ## ## ## ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ## ## ################################################################