COMP284 Scripting Languages (2016-17) — Assignment 1: Perl and CGI
Your task for this practical assignment consists of two parts:
1. Develop a Perl script using CGI.pm for a web-based system that provides the functionality stated in the Requirements section below.
2. Make the system that you have created accessible and usable via the URL
http://cgi.csc.liv.ac.uk/cgi-bin/cgiwrap/
taking care that the access rights for the file stat.pl are neither too restrictive nor too permissive.
Requirements
The DBLP Computer Science Bibliography is an on-line collection of bibliographic information for over 3.6 million publications by 1.8 million authors. Your system is intended to produce statistics for small subsets of that data, more precisely, it is intended to determine how many publications authors have written on a particular topic.
1. The script should display a web page that contains a form with two text fields and a `Submit’ button. The first text field should allow a user to enter keywords that describe an author or topic, called query in the following. The second text field should allow a user to enter a number that specifies the maximal number of publications that should be included in the statistics that the system will produce, called maxHits in the following
2. If a user presses the `Submit’ button, the system should first check the input. The system should check that query is a non-empty string and should take measures against code injection via this input. The system also needs to check that maxHits is a natural number greater or equal to zero. If one or more of these checks fails, then the system should generate a HTML page containing an error message for each check that has failed and prompt the user to start again.
3. If the user’s input passes these checks, then the system should retrieve information in XML format from the DBLP for up to maxHits publications matching query, this will be the query result. This can be done by retrieving the URL
http://www.dblp.org/search/api/?q=query&h=maxHits&c=4&f=0&format=xml;
Note that the query result is using UTF-8 encoding. You must make sure that your script and the output it produces correctly handles UTF-8 encoded Unicode characters.
4. For each publication the query result will include a list of authors. The system should count for each author in the query result how many publications in the query resulthe/she is an author of. The system should also determine how many publications are contained in the query result.
5. Once the system has completed the count, it should produce a HTML page that includes
· a statement of the query entered by the user, the XML data that was retrieved, and a statement of the number of publications that were retrieved.
· if and only if a non-zero number of publications was retrieved, two HTML tables, the first showing the ten authors with the most publications and the number of their publications (listed in order of the number of publications) and the second showing the ten authors with the least publications and the number of their publications (listed in reverse order of number of publications).
Each table should have two columns, one for the names of the authors, one for the number of publications and one row for each author. The columns should have appropriate headings, the tables should have appropriate titles. You are permitted to use Perl’s built-in sort function to produce those tables.
6. This HTML page should be displayed to the user as response to the URL the user has entered.
7. As this is an assignment on Perl, no other scripting languages should be used. In particular, JavaScript should not be used for input validation.
8. Your code should be properly commented. This includes pointing out which parts of your code have been developed with the help of on-line sources or textbooks by including references for these sources at the appropriate points.
Test data
Test data, together with the expected results, can be found at http://cgi.csc.liv.ac.uk/~ullrich/COMP284/tests-2016-17N/.
网站里内容:单独发一次
Submission
Submit your Perl script via the departmental submission system at https://sam.csc.liv.ac.uk/COMP/Submissions.pl (COMP284-1: Assignment1N (Perl and CGI.pm)). Do not forget to also complete the second part of the assignment.
Deadline
The deadline for this practical assignment is
Tuesday, 28 February 2017, 17:00
Earlier submission is possible, but any submission after the deadline attracts the standard lateness penalties. Please remember that a strict interpretation of `lateness’ is applied by the Department, that is, a submission on Tuesday, 28 February 2017, 17:01 is considered to be a day late. Note also that the University’s definition of `lateness’ for on-line submissions has changed and now counts Saturday and Sunday as `working days’.
Assessment
This practical assignment will address the following learning outcomes of the module:
· rapidly develop simple applications, both computer and web-based, using an appropriate scripting language.
· document and comment applications written using a scripting language.
This practical assignment will contribute 30% to the overall mark of COMP284. Failure on this assignment may be compensated by higher marks on other assignments for this module.
Marks will be awarded according to the following scheme:
· The Perl script is accessible via the required URL, the access rights of the script are not too permissive, and the script works without producing script errors: 10
· Correctness and quality of the solution (90 in total):
· Creating web interface and handling user input: 25
· Retrieving data from the DBLP and computing the statistics: 33
· Creating HTML page with result: 20
· Formatting, commenting, and quality of code: 12