Leser: 1
![]() |
|< 1 2 3 4 >| | ![]() |
40 Einträge, 4 Seiten |
1
2
3
4
5
6
7
8
9
10
11
sub ausgabe{
print qq~<html>
<body>
<h1>Fehlermeldungen</h1>
~;
for my $key(keys(%errors)){
print '<b>'.$_.'</b> '.$errors{$_};
}
print qq~</body>
</html>~;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
sub ausgabe{
open(my $fh,">ziel.html") or die $!;
print $fh qq~<html>
<body>
<h1>Fehlermeldungen</h1>
~;
for my $key(keys(%errors)){
print $fh '<b>'.$_.'</b> '.$errors{$_};
}
print $fh qq~</body>
</html>~;
close $fh;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<html>
<body>
<h1>Fehlermeldungen</h1>
<table>
<!-- TMPL_LOOP NAME=ERRORS -->
<tr>
<td>
<!-- TMPL_VAR NAME=CATEGORY -->
</td>
<td>
<!-- TMPL_VAR NAME=NUMBER -->
</td>
</tr>
<!-- /TMPL_LOOP -->
</table>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#! /usr/bin/perl
use strict;
use warnings;
use HTML::Template;
my $tmpl_file = '/path/to/template.tmpl';
my $template = HTML::Template->new(filename => $tmpl_file);
my %errors = (klein => 5, mittel => 10, groß => 1);
my @array;
foreach my $key(keys(%errors)){
push(@array,{CATEGORY => $key, NUMBER => $errors{$key}});
}
$template->param(ERRORS => \@array);
my $target = '/path/to/ziel.html';
open(my $fh,">$target") or die $!;
print $fh $template->output();
close $fh;
![]() |
|< 1 2 3 4 >| | ![]() |
40 Einträge, 4 Seiten |