The module is the original Perl interface to mSQL. While it has been replaced by the DBI modules, there are still many sites that depend on this old interface. To illustrate the use of, we will continue the teacher’s aide example.

Since we need classes in which to give the tests, let’s examine the table of subjects. The table structure looks like this:

CREATE TABLE subject (
  name CHAR(500),
  teacher CHAR(100)

CREATE UNIQUE  INDEX idx1 ON subject (


The id number is a unique identifier for the class, while the name and teacher fields are the name of the course and the name of the teacher respectively. There is also an index of all three of the fields that speeds up queries. Finally, we define a sequence for the table. The ID numbers are generated by this sequence.

The CGI program to access and manipulate this data must to several things.

  • Search for a subject in the database.

  • Show the subject that is the result of a search.

  • Add a new subject to the database.

  • Change the values of a subject in the database.

With the power of Perl and mSQL, we can easily consolidate all of these functions into one file, subject.cgi. We can do this by separating each operation into its own function. The main portion of the program will be a switchboard of sorts that directs incoming requests to the proper function. We will describe the actions themselves later.

# Each of the different parts of the script is selected via the ...

Get MySQL and mSQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.