$$\ $$$$$$\ $$\ $$\
$$ | $$ __$$\ \__| $$ |
$$$$$$\ $$$$$$\ $$$$$$\ $$ | $$ / \__|$$\ $$$$$$$\ $$$$$$\ $$ |
$$ __$$\ $$ __$$\ $$ __$$\ $$ |$$$$$$\ $$$$\ $$ |$$ __$$\ \____$$\ $$ |
$$ / $$ |$$$$$$$$ |$$ | \__|$$ |\______|$$ _| $$ |$$ | $$ | $$$$$$$ |$$ |
$$ | $$ |$$ ____|$$ | $$ | $$ | $$ |$$ | $$ |$$ __$$ |$$ |
$$$$$$$ |\$$$$$$$\ $$ | $$ | $$ | $$ |$$ | $$ |\$$$$$$$ |$$ |
$$ ____/ \_______|\__| \__| \__| \__|\__| \__| \_______|\__|
$$ |
$$ |
\__|
Final Assignment
Repository for the final project for the FHNW Course: Introduction to Perl for Programmers.
Author: Florian Thiévent
Used Modules from CPAN
- Text::Levenshtein
- Statistics::Lite
- Math::Round The modules can be installed all at once with the script install-modules.sh
Implemented Tasks
Task | File | Usage | Remarks |
---|---|---|---|
1a | shuffle.pl | perl shuffle.pl <path to masterfile as txt> |
The shuffled file is under ./out. If the directory is missing, the script generates it |
1b | score_exams.pl | perl score_exams.pl <path to masterfile as txt> <list of filled out exams> |
Exams can be list like exam1/file-*.txt |
2 | score_examps.pl | perl score_exams.pl <path to masterfile as txt> <list of filled out exams> |
Marked in File where this part is implemented |
3 | score_examps.pl | perl score_exams.pl <path to masterfile as txt> <list of filled out exams> |
Parts implemented |
Function of 1a
- load the file from the first cli arg
- turn content of file into an array with tie
- copy input array to output array, to prevent changing the original
- step through output array and searching for a question. a question starts with a digit followed by a period like 1.
- If a Question is found, create a new Hash in an array (possible_answers) to store the answers
- search for answers. an Answer starts with a [ and must be after a question
- if an answer is found, remove the solution marker (x or X) from within the square brackets and add the line index to the possible answers array
- Now for all found possible answers, load the slice from the output array, shuffle the slice and write it back to the output array
- Create the new filename from current time and date and the input filename
- Check if output path exists, if not, create it
- create a filehandler to write the content of the output array to a file
- write all lines and close the file.
Function of 1b, 2, 3
- load the masterfile from the first cli arg
- Extract all Questions and the right answers from masterfile
- Load an examfile
- load all answers to questions from the examfile, if no answer was given, it will be marked with a -
- compare the given answers to the correct answers from the masterfile
- make the stats and add them to stats array
- print out stats