Stefano Corsi > Quizzer-0.08 > Quizzer::Question

Download:
Quizzer-0.08.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Quizzer::Question - Question object

DESCRIPTION ^

This is an object that represents a Question. Each Question has some associated data. To get at this data, just use $question->fieldname to read a field, and $question->fieldname(value) to write a field. Any field names at all can be used, the convention is to lower-case their names, and prefix the names of fields that are flags with "flag_". If a field that is not defined is read, and a field by the same name exists on the Template the Question is mapped to, the value of that field will be returned instead.

METHODS ^

new

Returns a new Question object.

description

Returns the description of this Question. This value is taken from the Template the Question is mapped to, and then any substitutions in the description are expanded.

answer

Returns the abswer to this Question. This value is taken from the Template the Question is mapped to, and then any substitutions in the answer are expanded.

answer2

Returns the alternative answer to this Question. This is used when you want to allow an alternative answer to a Question (expecially questions where answers are provided by means of a String text field ...). This value is taken from the Template the Question is mapped to, and then any substitutions in the answer are expanded.

explanation

Returns the explanation of this Question. This value is taken from the Template the Question is mapped to, and then any substitutions in the explanation are expanded.

extended_description

Returns the extended description of this Question. This value is taken from the Template the Question is mapped to, and then any substitutions in the extended description are expanded.

choices

Returns the choices field of this Question. This value is taken from the Template the Question is mapped to, and then any substitutions in it are expanded.

choices_split

This takes the result of the choices method and simply splits it up into individual choices and returns them as a list.

variables

Access the variables hash, which is a hash of values that are used in the above substitutions. Pass in no parameters to get the full hash. Pass in one parameter to get the value of that hash key. Pass in two parameters to set a hash key to a value.

value

Get the current value of this Question. Will return the default value is there is no value set. Pass in a value to set the value.

value_split

This takes the result of the value method and simply splits it up into individual values and returns them as a list.

owners

This method allows you to get/set the owners of a Question. The owners are returned in a comma and space delimited list, a similar list should be passed in if you wish to use this function to set them. (Internally, the owners are stored quite differently..)

addowner

Add an owner to the list of owners of this Question. Pass the owner name. Adding an owner that is already listed has no effect.

removeowner

Remove an owner from the list of owners of this Question. Pass the owner name to remove.

AUTHOR ^

Joey Hess <joey@kitenet.net>

syntax highlighting: