Any fool can write code that a computer can understand. Good programmers write code that humans can understand -- Fowler

Tute #8 - "Style" and Web Client Programming

  1. Perl has two different ways in which variables can be declared. Here are two examples:

    my $name;
    local $sum;
    

    What is the difference between these two forms?

  2. What is effect of "use strict;" in a Perl program?

  3. In Lecture 14 we recommended separating HTML generation, configuration and storage management from the algorithm/business logic code. Discuss how you would organise this in your systems.

  4. Why is it recommended that you turn off the "-w" option for production Perl/CGI systems? When is this option particularly useful?

  5. In Lecture 14 we suggested that the use of die() function was not appropriate for production Perl/CGI systems. What should replace it?

  6. The example client program from lecture 15 used a Perl anonymous temporary file. An example program which performed much the same function without the necessity for a temporary file was also given.

    1. What is an "anonymous temporary file" and what particular advantage does it have compared to other ways of achieving the same result?

    2. In the second example program, the temporary file wasn't used. What advantage would potentially be gained by this approach? Are there any advantages to the use of a temporary file?

  7. The "Predicted Maximum Temperature" client program was particularly straightfoward compared to retrieving data from some other Web servers. What aspect of the Bureau of Meteorology Web pages made this a relatively simple exercise?