Thread Wagenanzeige Raspberry Pi (73 answers)
Opened by NIwu at 2014-10-25 13:58

Raubtier
 2014-11-04 19:02
#178106 #178106
User since
2012-05-04
1075 articles
BenutzerIn
[default_avatar]
Da ich Bahnfan bin, hier Code zum Rumspielen:

Code (perl): (dl )
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
use JSON::XS;
use strict;

my $abfahrenString = '[["S3","Dresden, Plauen","1"],["S1","Dresden, Flughafen","2"],["RE01","Meissen","10"],["ICE","Hamburg, Neugraben","15"]]';

my @keys = qw(ZugNr Richtung Minuten);
my @abfahrten = sort { $a->[2] <=> $b->[2] } @{decode_json $abfahrenString};

print "Content-type: text/html\n\n";
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">', "\n";
print "<html><head><title>Test-Ausgabe</title></head><body>\n";


print "\n";

print "<table><tr>";
print "<th>$_</th>" for @keys;
print "</tr>\n";

for my $zug (@abfahrten) {
    print "<tr>";
    print "<td>$_</td>" for @$zug;
    print "</tr>\n";
}

print "</table></body></html>\n";

View full thread Wagenanzeige Raspberry Pi