#!/usr/bin/perl -wuse strict; use diagnostics; use CGI; # Available from http://www.perl.com/CPAN use QuizQuestions;
# Maximum index for questions (starting at 0) my $MAX_QUESTIONS = 10;
# Create an instance of CGI my $query = new CGI;
# Print the MIME header that we will always use print $query->header("text/html");
# Determine how we were invoked my $request_method = $query->request_method;
# If we were invoked via POST, then ignore things for now if ($request_method eq "POST") { print $query->start_html(-title => "Not yet implemented"); print "Sorry, the POST part of this program isn't yet written.
\n"; print $query->end_html; } else { # If the query string is empty, then produce a page of HTML # containing ISINDEX if ($query->param("keywords") eq "") { print $query->start_html(-title => "Enter a quiz name"); print "Please enter the name of the quiz you want "; print "to create or edit in the below .\n"; print "\n"; print $query->end_html; } else { # Get the name of the quiz my $quizname = $query->param("keywords"); # Create a new instance of QuizQuestions my $questions = new QuizQuestions($quizname);
# Read the questions from disk, ignoring errors # (since we will happily create a new quiz) $questions->loadFile;
# Create the header for the HTML page print $query->start_html(-title => "Create/Edit a quiz");
# Define a form my $script_name = $query->script_name; print "