sub init { use strict; use warnings; use diagnostics; use HTTP::Module; use Some::Module; } sub print_header { my $query = new CGI; %vars = $query->Vars(); # ... } sub top_of_page { # ... } sub middle_of_page { # ... my ($dbuser, # database username $dbpass, # password for db $dbhost, # host for the database $dbport, # db connection port $dbname, # name of the database used $dbh, # DBI handle ); $dbuser = 'nobody'; $dbpass = 'NobodyPassword'; $dbport = '3306'; $dbhost = 'localhost'; $dbh = DBI->connect('DBI:mysql:$dbname:$dbhost:$dbport', $dbuser, $dbpass, {RaiseError => 1}); } sub left_content { if (!$vars{action} || $vars{action} eq "home") { # print the generic left content here } # ... } sub right_content { if (!$vars{action} || $vars{action} eq "home") { # print the generic right content here } # ... } sub bottom_of_page { # ... } sub end_content { # ... }