Hi,
  Look at http://alon1.dhs.org/cgi-bin/lectures.pl for first output of
automatic scirpt.
  There are some problem that still need to be fixed.
  I've attached the source for your review.

-- 
This message was sent by Alon Altman ([EMAIL PROTECTED]) ICQ:1366540
The RIGHT way to contact me is by e-mail. I am otherwise nonexistent :)
--------------------------------------------------------------------------
Alimony and bribes will engage a large share of your wealth.
#!/usr/bin/perl -w
use CGI qw/:standard/;

print header();

print start_html();

my $DATA_DIR="/home/alon/cgi-bin/lecture-data/";
my $DATA_FILE="list";
my $LECT_FILE="lect.dbm";
my $LECT_DIR="http://linuxclub.il.eu.org/lectures";;
my $time=time();

dbmopen %lect,"$DATA_DIR/$LECT_FILE",0644;

unless (param()) {
  print <<'EOF';
<H1>Lecture list</H1>
<TABLE BORDER>
<TR><TH>No.</TH><TH>Title (click for sldes)</TH><TH>Lecturer</TH>
    <TH>Date</TH><TH>Comments or Links</TH></TR>
EOF
  open(DATA,"$DATA_DIR/$DATA_FILE") or die "Can't open data file\n";
  my $num=0;
  while (<DATA>) {
    chomp;
    my ($xn,$link,$title,$lect,$dt,@links)=split("\t");
    if ($dt>$time) {
      $time='2000000000';
      print <<'EOF';
</TABLE>
<H2><A NAME="future">Future Lectures</A></H2>
<TABLE BORDER>
<TR><TH>No.</TH><TH>Title (click for sldes)</TH><TH>Lecturer</TH>
    <TH>Date</TH><TH>Comments or Links</TH></TR>
EOF
    }
    unless ($xn) {
      $xn=++$num;
    }
    unless ($link) {
      $link="$LECT_DIR/$xn";
    }
    if ($link eq 'x') {
      $link=$title;
    } else {
      $link="<A HREF=\"$link\">$title</A>";
    }
    $title =~ s/</\&lt\;/go; $title =~ s/>/\&gt\;/go;
    $lect =~ s/^\s*(\S)/$1/; $lect =~ s/(\S)\s*$/$1/;
    my ($sec,$min,$hour,$mday,$mon,$year,$wday)=localtime($dt);
    my $linfo=$lect;
    if ($lect{$lect}) {
      $linfo="<A HREF=\"".$lect{$lect}."\">$lect</A>";
    }
    print "<TR><TD>$xn</TD><TD>$link</TD><TD>$linfo</TD>";
    printf "<TD>%02d/%02d/%02d %02d:%02d</TD>",$mday,$mon+1,$year%100,$hour,$min;
    print "</TD><TD>";
    if (@links) {
      print "<UL>";
      foreach $lnk (@links) {
        print "<LI>$lnk</LI>";
      }
      print "</UL>";
    }
    print "</TD></TR>\n";
  }
}

print "</TABLE>\n";

print end_html();

dbmclose %lect;

Reply via email to