NAME
MathsQuestion - Supplier of simple maths questions to Question or Quiz.
SYNOPSIS
use MathsQuestion;
use Quiz;
use strict;
my @list;
my @qs = qw(add subtract multiply divide);
foreach (@qs) {
my ($qst, $ans) = MathsQuestion->new($_, 1);
push (@list, $qst, $ans);
}
my $quiz = Quiz->new(@list);
$quiz->prompt('Question: '); #going to use our own prompt.
while ($quiz->unanswered_questions) {
print $quiz->next_question, "\n";
$_ = <>;
if ($quiz->check_guess($_)) {
print $quiz->{right_message};
} else {
print $quiz->{wrong_message};
}
}
$quiz->finished;
print $quiz->results;
exit;
- new
-
Create new object: my $m = MathsQuestion->new($func, $level); #$level is either 1, 2 or 3, default is 1. #add, subtract, multiply, divide #? or a, s, m, d #? or + - x / %(o) my $mx = MathsQuestion->new('m');
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 46:
'=item' outside of any '=over'
=over without closing =back