1 2 3 4 5 6 7
use CGI; use Mein::Modul; my $cgi = CGI->new; my $param = $cgi->param('key') || 'default'; if ($param eq 'gewuenschter wert') { Main::Modul::funktion(...); }
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 26 27 28 29 30 31 32 33 34 35 36 37 38
use strict; use warnings; use CGI; # selbst geschrieben use frames::inside; my $cgi = CGI->new(); my $inside=''; $inside=frames::inside->render($cgi) if($cgi->param('inside')); print $cgi->header(); print <<HTML; <html> <head><title>TEST</title></head> <body> <table> <tr> <td> </td> <td>TOP</td> <td> </td> </tr> <tr> <td>LEFT</td> <td>$inside</td> <td>RIGHT</td> </tr> <tr> <td> </td> <td>BOTTOM</td> <td> </td> </tr> </table> </body> </html> HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
package frames::inside; use strict; use warnings; sub render { my $class=shift; my $cgi=shift; my $aktion=$cgi->param('inside'); my $text='MIDDLE'; $text='<b>Hier ist der Text!</b>' if($aktion && $aktion eq 'text'); return $text; }
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 26 27 28 29 30 31 32 33 34 35
use strict; use warnings; use HTML::Template::Compiled; use CGI; my $cgi = CGI->new(); my $time = localtime(time); my $template = <<HTML; <html> <body> <table> <tr> <td>Blah ist $time</td> <td><?if k ?>Key ist <?= k ?><?/if k ?></td> <td>Blubb</td> </tr> </table> </body> </html> HTML my $htc = HTML::Template::Compiled->new( tagstyle => [qw/+php/], scalarref => \$template, cache => 0, ); $htc->param( k => $cgi->param('key'), ); print $htc->output;