#!/usr/bin/perl -w use strict; use CGI; my $cgi = new CGI; my $PresID = $cgi->param("PresID"); my $Title = $cgi->param("Title"); my ($Day, $SessionNum, $Time, $Name) = split(m/-/, $PresID); my $Session = "$Day-$SessionNum"; my $Dir = "files/"; my $BaseWWWDir = "files/"; my $Err = ""; if ($PresID !~ m%^([A-Z][A-Z])\-(P|\d\d)\-(P\d\d|\d\d\d\d)(\-([A-Za-z]+))?$%) { $Err = "Invalid ID."; } else { $Dir .= $PresID; } print < $Title

Session $Session Presentation:

$Title

To use PowerPoint files, download the presentation file and any supporting files to a common folder.

HTML if ($Err) { print qq(ERROR: $Err); } else { my @files = glob("$Dir/*"); my @presFiles = grep(m%\.(ppt|pdf)$%i, @files); if (scalar @presFiles) { my $count = (scalar @presFiles == 1 ? "One" : scalar @presFiles == 2 ? "Two" : scalar @presFiles == 3 ? "Three" : scalar @presFiles); my $postfix = (scalar @presFiles > 1 ? "s" : ""); print <Presentation File$postfix $count presentation$postfix found. Click the following links to download:

HTML foreach my $file (@presFiles) { (my $name = $file) =~ s%^.*[\\\/]([^\\\/]+)$%$1%; print qq($name.
\n); } } my @supFiles = grep(! m%\.(ppt|pdf|dontuse)$%i, @files); if (scalar @supFiles) { my $c = scalar @supFiles; my $count = ($c == 1 ? "One" : $c == 2 ? "Two" : $c == 3 ? "Three" : $c); my $postfix = ($c > 1 ? "s" : ""); print <Supporting File$postfix $count supporting file$postfix found. Click the following links to download:

HTML foreach my $file (@supFiles) { #if ($file !~ m%\.(ppt|pdf|dontuse)$%i) { (my $name = $file) =~ s%^.*[\\\/]([^\\\/]+)$%$1%; print qq($name.
\n); } } } } print < HTML