Contact Jon Day (877 329-4839 or Jon@DaySite.Net to discuss your web site database programming needs.
Perl Databases and Webpages
Perl is the most used programming language on the Internet. Partly due to its simplicity, mostly due to is strengths. Perl has also been around for a long time, so lots of programmers know it. In addition there are thousands of pragrams and modules already written to accomplish just about anything you want. Perl is particularly good at manipulating text. Yes text, like what you find in a database, and what makes up a Website.
Combining Perl with a nimble database like MySQL, through the DBI interface is powerful, as well as easy to learn. It is hard to beat this combination when the task involves generating on-the-fly, or dynamically generated Webpages.
Example Uses
- Display available inventory
- Log customer of inventory orders
- Real time customer account information
- Tracking the order status
- Logging email communications
- Colaborative Webpage design and updates
- Membership or company directory display and maintenance
Plus a couple of thousand other uses.
The following script is written in Perl, uses DBI to extract a single record from a MySQL database. The initial inquiry could be a Webpage with a form where the user is asked for identification or password, in this example we call it 'membernumber':
Again, a very simple example. But let's review it step-by-step.
- First we tell the server that this script is to be run with Perl
- Then we call the CGI.pm module, which takes care of a lot of messy work.
- Then the DBI module is called up to interface between the Perl and the Database
- Then we tell DBI that we are using a database called 'databasename' in the MySQL database server, which requires 'username' and 'password'
- Then we parse the incoming membernumber and assign it to a variable appropriately called '$memernumber'. NOTE: the Dollar sign in front of a name makes a Per variable.
- Then comes the SQL call to the database:
We are calling for the (name, address, city, state, zip, phone, email) fields
from the 'membership' table
which has the specified 'membernumber' listed in the membernumber field
and execute the quiry
- Next we use fetchrow_array(); to assign appropriately named variable and extracted field data to them
- Now we tell the Browser to print in HTML format
- and print the form with appropriately located variables.
Now that wasn't so hard was it. But from here it grows and grows.
The DaySite Web servers are equipped with all the tools necessary to create elaborate database applications using Perl, MySQL, DBI and CGI.