NAME
Games::QuizTaker - Take your own quizzes and tests
SYNAPSIS
use Games::QuizTaker;
my $GQ=Games::QuizTaker->new(FileName=>'test.psv');
$GQ->load;
$GQ->set_MaxQuestions(2) # Set the number of questions you wish to answer on the test. This is optional.
$GQ->generate;
$GQ->test;
DESCRIPTION
- new
-
C< my $GQT=Games::QuizTaker->new(FileName=>"File",Delimiter=>",",AnswerDelimiter=>"|",Score=>1); > This method creates the Games::QuizTaker object as an inside out object. The method can take up to four arguments, and one of them (FileName) is mandatory. If the FileName argument is not passed, the method will croak. The Delimiter argument is the separator within the file that separates the question number, the question, its answers, and the correct answer. The AnswerDelimiter is used to separate the answers of questions that have multiple answers. The Score method takes a numeric argument. If set to 1, it will print out an overall score at the end of the test. If left undefined(the default), it will not print the results. This is useful if setup in a login script to do a single question at login. The default for the Delimiter parameter is the pipe "|" chararcter, and the default for the AnswerDelimiter is a space. Also note that while the method names are case-sensitive, the parameter names are not, so the parameters can be spelled in all lower case and the object will still put the parameters and their arguments exactly where they belong.
- load
-
C< $GQT->load; > This method loads the question file into the object, and sets the internal FileLength parameter.
- generate
-
C< $GQT->generate; > This method will load all of the questions and answers into the test hashes by default, unless the MaxQuestions internal parameter has been set. This is checked for at the beginning of the method
- test
-
This method actually prints the questions out and waits for the answer input. It will check the user's input against the correct answer and report back if they match or not.
- get/set methods
-
The purpose of these methods should be self-explanatory, so I won't go into them other than to provide a list of them: get_FileName,set_FileName get_AnswerDelimeter,set_AnswerDelimeter get_Delimeter,set_Delimeter get_Score,set_Score get_FileLength,set_FileLength get_MaxQuestions,set_MaxQuestions
EXPORT
None by default
DEBUGGING
None by default
TODO LIST
None by default
ACKNOWLEDGEMENTS
Thanks to Jerry D. Heden for creating the Object::InsideOut module which I used to create this version of Games::QuizTaker. Thanks to Damian Conway for his book "Perl Best Practices" which gave me the initial idea to use an insideout object to implement the module
AUTHOR
Thomas Stanley
Thomas_J_Stanley@msn.com
I can also be found at http://www.perlmonks.org as TStanley. You can also direct any questions relating to this module there.
COPYRIGHT
Copyright E2001-2006 Thomas Stanley. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.SEE ALSO
perl(1) Object::InsideOut