next up previous
Next: Java and Its Use Up: Some Specific Web Technologies Previous: Some Specific Web Technologies

PERL4 and PERL5-CGI Scripts

PERL is a very well-know interpreted language that was developed (before the Web) as a powerful systems programming language. Although aimed at UNIX, PERL is also available on PC Windows platforms.

PERL is commonly used in so-called CGI Scripts that conveniently extend the capability of servers, as shown in Figures 2 and 3. In theory, one can use any language in a CGI Script, including higher-level shell Scripts or high-performance languages, such as C or C++. In fact, as shown in Figure 3, one can expect Java to be increasing used for server side extensions for both CGI and more sophisticated mechanisms. However, PERL currently has the most powerful text processing and (UNIX) file system handling capabilities of any common language, and is clearly currently superior to Java and JavaScript in this regard. The most common use of CGI Scripts is processing of HTML form input (see Figure 13) and this is dominated by text and file manipulation. Further, such work is often not compute intensive, and a flexible interpreted implementation has adequate performance. Thus, PERL remains the language of choice for CGI programs. Further, many Web applications require substantial use of (off-line) utilities to reformat text, and prepare information. Here again, PERL currently is the best implementation language. Note that hybrid approaches for CGI Scripts are quite common with a PERL interpreted ``wrapper'' invoking special applications, such as database engine or an optimized C or Fortran numerical simulation.

  


Figure 13:

When we describe JavaScript, it provides an alternative way of processing HTML forms solely on the client side. However, this is only appropriate for some Web applications, and many require server side processing either due to the complexity of the computation, or the need to access information stored on the server file systems. Thus, PERL and JavaScript offer complementary capabilities.

Java is already the preferred implementation of customized servers, such as those described in Section 4 for supporting collaboration. However, until Java has the same convenient text processing and flexible interpreted implementation, PERL will continue to be used extensively for CGI Scripts.

The most recent version, PERL5, has important extensions--especially in the area of multi-dimensional arrays and object-oriented features. However, although the new arrays features are very helpful, we find the object-oriented implementation much less elegant than Java, and it has not been broadly adopted.

In Figure 14, we show a simple ``Hello World'' program in PERL, showing the use of so called variable interpolation in character strings. In Figure 15, a HTML page allows the user to input a name that generates a ``Hello World'' HTML page using the PERL CGI Script in Figure 16.

  

Figure 14: Simple PERL Program to read in name input and output a Cheery Greeting

  

Figure 15: HTML Page defining Hello World with (a) HTML displaying as shown in (b). The result is displayed in (c).

  

Figure 16: CGI Script used in previous example


next up previous
Next: Java and Its Use Up: Some Specific Web Technologies Previous: Some Specific Web Technologies

Geoffrey Fox, Northeast Parallel Architectures Center at Syracuse University, gcf@npac.syr.edu