#!/usr/bin/perl -w
# csv2html.pl - Konvertiert CSV-Dateien nach HTML
# Copyright (C) Sam Aug  4 13:59:19 MEST 2001 by Ingo Blechschmidt
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Ingo Blechschmidt
# Arberstra&szlig;e 5
# 86179 Augsburg
# E-Mail: iblech@web.de, http://www.way.to/uselinux/
# Tel.: +49 / 821 882955
#
# 
$TITLE="CSV2HTML";
print "Content-type: text/html\n\n";

open(EINGABE, "<daten.csv") || die;

print "<html>\n<head>\n<title>$TITLE</title>\n</head>\n<body
bgcolor=\"#ffffaa\">\n\n";

print "<h1 align=\"center\">$TITLE</h1>\n<hr />\n\n";

print "<table border=\"2\" cellpadding=\"3\" cellspacing=\"1\">\n";

$header = <EINGABE>;
@zeile = split(";", $header);
print "<tr>";
foreach $zeile (@zeile) {
  print "<th bgcolor=\"#ffaaaa\">$zeile</th>";
}
print "</tr>\n";

@tabelle = sort(<EINGABE>);
foreach $zeile (@tabelle) {
  @zeile2 = split(";", $zeile);
  print "<tr>";
  foreach $zeile2 (@zeile2) {
    print "<td bgcolor=\"#aaaaff\">$zeile2</td>";
  }
  print "</tr>\n";
}

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

close(EINGABE);
