#!/usr/bin/perl use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); use strict; use warnings; use vars qw($fullname $anslength @allselections $file $fname $lname $time $reviewtime $idinput $id $courselocation $useripaddress $questionno @log $clocktime $log $type $value @answers $buttonname %selections @options); my @allquestions; my @allanswers; my @explain; print header; # ********************************* DEFINE VARIABLES $time = param('time'); $reviewtime = param('reviewtime'); $file = param('file'); $idinput = param('idinput'); $fullname = param('fullname'); $fname = param('fname'); $lname = param('lname'); $courselocation = substr($file, 0, 6); $useripaddress = $ENV{REMOTE_ADDR}; $questionno = 0; print "
"; print "";
print start_form (-name=>'makequiz', -method=>'POST', -action=>"http://ist221.nsm.tridenttech.edu/perl/gradequiz.cgi");
chdir("/perl/web");
open FILE, "$file" || die "Cannot open $file: $!";
while ( ";
}elsif ($type =~ m/q/i) { # ** CHECKS FOR QUESTION LINE & PRINTS QUESTION
$questionno++;
print "$questionno. $value ";
# ************************* END SUBROUTINE MAKEEXAM
print end_html;
";
print "
";
push(@allquestions, $value);
}elsif ($type =~ m/a/i) { # ** CHECKS FOR ANSWER LINE
@answers = split (/`\s*/, $value);
$anslength = @answers; # ** LENGTH OF @ANSWERS
push(@allanswers, $value);
}elsif ($type =~ m/s/i) { # ** CHECKS FOR SELECTION LINE
$buttonname = $type . $questionno;
push(@allselections, $value);
%selections = split (/`\s*/, $value);
@options = keys (%selections);
if ($anslength > 1) { # ** DETERMINES TO USE RADIO OR CHECKBOX
print "
";
print checkbox_group(-name=>$buttonname, -values=>\@options, -linebreak=>'true', -labels=>\%selections);
}else {
print "
";
print radio_group(-name=>$buttonname, -values=>\@options, -linebreak=>'true', -labels=>\%selections, -default=>'-');
}
print "
";
}elsif ($type =~ m/e/i) {# ** CHECKS FOR EXPLAINATION LINE
push (@explain, $questionno, $value);
} # END ELSIF STATEMENTS
} # ** END WHILE STATEMENT
close (FILE);
print "