package newindex; use strict; sub getTitle { return "workers"; } sub getContent { my $cgi = shift; $hashref = { 'Adam' => 'Eve', 'Clyde' => 'Bonnie', }; my $table = ; return $table; } 1; #### #!"C:\xampp\perl\bin\perl.exe" use strict; use warnings; use CGI qw/:standard/; push @INC, "."; sub getHeaders { my $cgi = shift; return $cgi->header('text/html'); } sub getBody { my $cgi = shift; return $cgi->start_html( getContent($cgi,'title') ) . getContent($cgi,'content') . $cgi->end_html; } sub getModule { my $cgi = shift; my $action = $cgi->param('action') // 'newindex'; $action = 'newindex' unless (-f $action.'.pm'); eval "use $action;"; return $action; } sub getContent { my ($cgi,$call) = @_; my $module = getModule($cgi); my $caller = 'get'.ucfirst($call); return $module->$caller($cgi); } sub main { my $cgi = new CGI; print getHeaders($cgi) . getBody($cgi); } main();