# main handler use strict; # this is a sub-class of my module WSC::Common which puts a # database handle and the request object in a common object # (as well as sets up all the other functions etc.) use SWMetal::Init (); # Configuration for this site use SWMetal::Conf (); # all the other needed modules are in the startup.pl sub handler { my $r = shift; my $apr = Apache::Request->new($r); my $conf = SWMetal::Conf->new(); my $common = SWMetal::Init->new($apr,$conf,{admin=>1}); my %admin_scripts = ( # Here theres a hash with referenced functions # that can get called. ); # I call them 'scripts' because to make URLs shorter # I used the path_info function my $script = $apr->path_info(); # some regex stuff here to strip any slashes or other # unwanted stuff from $script if(exists $admin_scripts{$script}) { return $admin_scripts{ $script }->($common); } else { return $admin_scripts{default}->($common); } } # all that works fine .. then in the called function sub foo { my $common = shift; # usually there is some kind of request. my $apr = $common->apr; # common has an AUTOLOAD sub that returns the key of the hash based on the function name. # Then the problem occurs here, with the first call to param(): my $request = $apr->param('request'); # .... more stuff }