#! /usr/bin/perl use warnings; use strict; my %Actions = ( boardconf => { subs => [ \&handler_boardconf, ], }, otherconf => { subs => [ \&handler_otherconf, ], }, ); sub handler_boardconf {    my ($r) = @_;    my $action = lc($r->param('action'));    handler_handler($r, $action, \%BoardConf::Actions, 'start'); } sub handler_otherconf {    my ($r) = @_;    my $action = lc($r->param('other'));    handler_handler($r, $action, \%OtherConf::Actions, 'begin'); } sub handler_handler {    my ($r, $action, $ref, $def) = @_;    unless(exists $ref->{$action}->{subs})    {       $action = $def;    }    foreach my $sub (@{$ref->{$action}->{subs}})    {       unless ($sub->($cgi))       {          # error in sub          last; # errorhandling       }       else       {          # ok       }    } } sub handler {    my $r = Apache::Request->new(shift);    $r->send_http_header('text/html'); my $section = lc($r->param('section'));         handler_handler($r, $section, \%Actions, 'boardconf'); }