#!/usr/bin/perl -wT use strict; use SuperModule; use CGI; my $q = CGI->new(); # magic here my %actions = ( login => \&do_login, post => \&do_post, pyro => \&set_someone_on_fire ); my $action = $q->param('action'); if (defined $actions{$action}) { $actions{$action}->($q); } else { default_page($q); } sub do_login { # check login parameters here my $q = shift; SuperModule::login($q); # or whatever }