> What about having $self->current_rm() as an object function instead of > passing it around into and out of sub-routines? > > then you could get the rm: > my $rm = $self->current_rm(); > > and change the rm: > $self->current_rm( $rm );
I like this idea, but it could get more involved. I currently have some modules that change run_mode in setup() (I check the validity of some passed fields, if they don't pass, I force it to a "get valid data" default). In those cases I don't have to use cgiapp_prerun, because I didn't care what mode I was in. I also didn't want to put it in every runmode, because those are simple modules with one "gather data" mode and a few display modes -- no need to complicate mulitple runmodes. So, assuming I'm not alone in this, we could end up with a module that alters runmode in setup() (by changing the 'rm' [or whatever] param) as well as in cgiapp_prerun (via your current_rm() method). Inconsistant interface. Plus, it could confuse new users, who would try something like: sub Save_Runmode { my $self = shift; if( not $self->Valid_Data()){ #wrongly expect this to work now. $self->current_rm('Error_Runmode'); } #other stuff here } OTOH, there isn't a consistant interface, and your proposed object function is the nice standard way of doing such things. --------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/cgiapp@lists.vm.com/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]