package My::Handler; sub handler { my $r = shift; # translate from URL to package name, and the "action" # that you want to perform my($pkg, $action) = figure_out_package_name($r->uri); # instantiate, and call the appropriate handler my $obj = $pkg->new(); $obj->dispatch($action); }