Joel Gwynn wrote:
> 
> Using cgi::app, I end up beginning each runmode subroutine like this:
> 
> sub thisform {
>     my $self = shift;
>     my $dbh = $self->param('dbh');
>     my $q = $self->query;
> ...

I keep them both in global variables. The param system give you the
essential function of global variables: read them anywhere and write
them anywhere. Therefore, I think good programming style is not so much
about using globals versus the param system, but rather using either
system sensibly or not. 

I prefer globals to avoid the situation you describe. The only pitfall
I've found with using globals are some rare name space issues. When you
are passing around the object explicitly and referring to things inside
of it, you don't have to worry about the name space of the variables
inside the object, just that you have to pass it around everywhere. 

On rare occasion in my systems using globals, I'll find that the
variable isn't available directly in the name space I want. I can then
work around that by doing some explicit exporting and importing, or
putting code someplace that can exist in either name space. 

  -mark

http://mark.stosberg.com/

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to