giFT

Gift is a Perl parser for Moodle Gift format.
Download

giFT Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Price:
  • FREE
  • Publisher Name:
  • jasta
  • Publisher web site:

giFT Tags


giFT Description

Gift is a Perl parser for Moodle Gift format. Gift is a Perl parser for Moodle Gift format.SYNOPSIS use Gift; my $result = Gift->GiftFromFile($filename); my $result = Gift->GiftFromString($input);Moodle is an Open Source Learning Management System. It uses GIFT (which stands for General Import Format Technology) to save and recover quiz questions to and from text files.This module provides a parser for the GIFT format.The idea which moved us to write it was that Perl programmers writing translators from GIFT format to other formats (most commonly to other course management system formats but also to edition languages like LaTeX or to produce a standalone CGI for the quizs) can benefit of having the parser and concentrate their efforts in writing the back-end phase of generating the target format.Methods in the Gift class: GiftFromFile and GiftFromStringThe method GiftFromFile receives as its only parameter the name of a file containing a questionnaire written in Moodle GIFT format. It returns a Gift object describing the questionnaire.The method GiftFromString is similar but receives the input string containing the questions in GIFT format.The following script gift enclosed with this distribution illustrates the use of the method: $ cat gift #!/usr/bin/perl -I../lib -w use strict; use Gift; use Data::Dumper; die "Usage:n$0 giftfilen" unless (@ARGV == 1); my $result = Gift->GiftFromFile(@ARGV); print Dumper($result);Let us feed the script with the following numeric1.gift file as input: $ cat numeric1.gift When was Ulysses S. Grant born? {# =1822:0 =P22:2}When running it, we get this output that describes the generated data structure:$ gift numeric1.gift $VAR1 = bless( }, { 'WEIGHT' => 50, 'COMMENT' => undef, 'TYPE' => 'NUMERIC', 'ANSWER' => }, 'POSTSTATE' => '', ] }, 'Gift::NUMERIC' ) ], 'Gift' );A Gift object is an array of questions. Each question is an object blessed in its class. The following classes of questions are supported:Gift::MATCH for Matching questionsGift::MULTIPLEANSWER for multiple choice questions where two or more answers must be selected in order to obtain full creditGift::MULTIPLECHOICE for Multiple Choice questionsGift::NUMERIC for the two types of numeric questions (range and threshold)Gift::SHORTANSWER for Short Answer questionsGift::TRUEFALSE for True-false questionsA question is a hash with 3 keys: PRESTATE, POSTSTATE and ANSWERS. These keys correspond to divide a gift question in three parts prefix-statement { answer section } post-statementThe hash entry PRESTATE is a reference to a hash with keys:FORMAT describing the format in which it is written the question: html, plain, etc.,NAME the optional name for the question andPREFIX containing the text of the question before the answer section.The hash entry POSTSTATE is a string containing the text of the question after the answer section.The hash entry ANSWERS is a reference to an array of hashes describing the list of answers for this question. The fields in these answer hashes depend on the class of question and are described below. Requirements: · Perl


giFT Related Software