![]() |
![]() |
10 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use CGI;
use vars qw(%Actions);
%Actions = (
eins => { code => \&Action1, template => 'action1.tmpl', x => 20 },
zwei => { code => \&Action2, template => 'action2.tmpl', a => 30 },
drei => { code => \&Action3, template => 'action3.tmpl', foo => 'bar' },
default => { code => \&Start, template => 'start.tmpl' },
};
my $cgi = CGI->new();
my $action = $cgi->param('action');
if ( defined $action and exists %Actions{$action} ) {
$Actions{$action}->{code}->($cgi, $action);
}
else {
$Actions{"default"}->{code}->($cgi, "default");
} #else
# --------------------------------
sub Action1 {
my ($cgi, $action) = @_;
my $template = $Actions{$action}->{template};
...
} # Action1
# -------------------------
![]() |
![]() |
10 Einträge, 1 Seite |