/cgi-bin/html.lib
sub html_head {
$background = shift;
$width = shift || 640;
print <<EOD
<html>
<head>
<title>FriendNet! - A place for friends</title>
</head>
<body bgcolor=lightblue color=black background=$background>
<table width=$width><tr><td>
EOD
}
sub html_foot {
print <<EOD
</td></tr></table>
</body>
</html>
EOD
}
sub h1 {
"<h1>@_</h1>";
}
sub h2 {
"<h2>@_</h2>";
}
sub h3 {
"<h3>@_</h3>";
}
sub img {
$src = shift;
"<img src=$src" . attr_expando(@_) . ">";
}
sub select_option {
$name = shift;
$value = shift;
$s = "<select name=$name>";
for $i (@_) {
if ($i eq $value) {
$s .= "<option selected>";
} else {
$s .= "<option>";
}
$s .= "$i</option>";
}
$s .= "</select>";
return $s;
}
sub friendnet {
"<font color=red>Friend</font><font color=blue>Net!</font>";
}
sub attr_expando {
%attr = @_;
$s = '';
for $k (keys %attr) {
$s .= " $k=$attr{$k}";
}
return $s;
}
1;