in reply to Passing variables between packages

Please look at CGI::Application (and also CGI::Application::Dispatch, once you've digested the former). The documentation is very readable and includes examples which you will find illuminating.

I don't want to spoil the plot for you but here's a snippet - using this approach your view runmode may look like:

sub view { my $self = shift; my $q = $self->query; my $dbh = $self->param('dbh'); ... }
C::A objects can get to the cgi object via $self->query, so no need to pass that around. And you can pass other stuff between runmodes using C::A's param method.

Replies are listed 'Best First'.
Re^2: Passing variables between packages
by bibliophile (Prior) on Aug 23, 2005 at 18:51 UTC
    I wish I could double-plus this!

    It's well worth the (slight) time and effort to get comfortable with CGI::Application.

    Soon you, too, can be mad-drunk with power! Er... I mean... "Able to crank out complex and powerful web apps in your sleep".