James H. Zisch - Computer Services

Support : Guides

 

PERL

PERL (Practical Extraction Reporting Language) is a computer application programming language. PERL is used extensively for Website server-side CGI (Common Gateway Interface) process handling. Unique to PERL is a cooperative willingness toward cross-platform and open-source support; a serious consideration to insure ease of migration to other platforms.

You will find links to PERL resources in the GUIDES: Resource Links page.

Language Basics

PERL is an interpretive computer programming language meaning that the computer source is not compiled into computer object code. For this reason, PERL programs are typically referred to as "scripts". Advantage is significantly reduced time to produce and maintain functional logic solutions. Disadvantages include a potential for over extension of system resources due to poorly designed code and the interpretation process. Using PERL as CGI requires careful planning and design to assure for optimum performance, migratability and maintainability.

Input Handling

From the CGI perspective the input to a PERL script/program requires that it be translated from the standard transmission format prepared by a Web Browser before the data is sent. This preprocessing of data provides the cross-platform support that allows computers of different types to send and receive data by putting that data into a common format based on data type and independent the sending and receiving computer platform; a fundamental aspect that allows the World Wide Web to function. Inter and Intra-program calls does not require formatting and translation prior to processing. After translation the data may be inspected and manipulated as objectives require.

There are two methods which CGI input parameters may be passed; GET and POST. The method determines how the input data is passed to the CGI program. The GET method passes input data as as argument string and is accessed via system's standard input buffer (STDIN). The environment variable QUERY_STRING contains the length value of the data providing size of the data to be read using the standard READ command. The POST method passes the data into the environment variable (QUERY_STRING). Both methods result in the data being packaged as variable name and value pairs, so following access to the data it is generally required that the name and value pairs be parsed into program variables or array elements in order to use the data. Keep in mind that the data being passed in as input data can be in a variety of formats each having their own particular requirements in order to preserve the data in its intended format. These data formats include text, image and binary data.

Logical Processing

Between the PERL CGI's in and out processing is the logical processing that achieves the objective of the script/program. There is no restriction or technological limitation as to the processing that can be accomplished during this process beyond that of the system and its available resources. All typical processing methodologies normally available to a standard application program is equally available.

Considerations should include resource availability and utilization specific to a multi-user environment. Processes should not perform indefinite functions that could result in unexpected results especially deadly embraces and/or dead locking of resources. Files accessed for both read and write must be protected from corruption resulting from operating system file caching, as well as system failures. Transaction processing is an example of the more sophisticated requirements of multistage processes where data interdependence is crucial to the integrity of the system. PERL does provide file locking capabilities; however, the method is a soft locking mechanism. For this reason it is strongly recommended to evaluate data design considerations to determine if a database management system is required in order to satisfy data integrity requirements.

System performance is another design consideration. Apply proven multi-user environment techniques and methodologies to meet these design requirements.

Output Handling

A PERL CGI may pass its output in a variety of formats. Regular file input/outputs are processed in the usual manner. Output back to the calling Web Browser is processed via the Web Server by passing the output to the system's standard out (STDOUT) buffer. A variety of file formats are permitted and include HTML page data, image, video and sound. The type of file format of the output must be specified via the Content Type parameter that associates with either a standard MIME type or a previously defined MIME type that both the Web Server is configured to properly processing and the receiving Web Browser is configured to recognized and understands how to process.

Language Keyword Reference

Advanced Features -

Database - PERL DBI

PERL DBI (Database Independence) is a PERL subset providing API to commonly used database subsystems.

Network Interface

PERL includes subset components providing a series of source level client-server network interfaces. These can provide a streamline methodology for achieving complex objectives with minimal development time.

E-mail

PERL CGI process e-mail via an API or PERL subset. SENDMAIL is an e-mail subsystem providing API to the SMTP subsystem. When installed and configured SENDMAIL may be opened as a pipe and the PERL CGI can stream to it. SENDMAIL is typically available on most UNIX systems. Also available is the PERL NET::SMTP package that can be used as an alternative.