adelton

Examples for the lecture

The examples are annotated in Czech.

In the lecture I show some examples of using Perl and modules from CPAN for building network applications. Scripts shown here should only be used as examples, not as complete solutions. Before running them on production machine check all security aspects. For example with the httpd, what would happen if someone sends you two dots to get to parent directory?

The simplest way of downloading document from the Web is using LWP::Simple. A simple solution is also provided by lwp-rget for recursive downloads from server. If you want to process the HTML document we received, we should use LWP::UserAgent and either write our own regular expression for relevant data or use existing modules, for example for listing the links or further postprocessing (conversion to absolute URLs).

We can use Perl for parsing httpd logs and producing statistics or for CGI scripts.