Web Development Overview with Perl and MySQL
Web Development Basics with Perl and MySQL – Part 1
Web Development with Perl and MySQL
Foreword: In this part of the series, I give you an overview of web development with Perl and MySQL.
By: Chrysanthus Date Published: 28 Jan 2015
I use ActivePerl, which is for the Windows Operating System. If you are using a different operating system, then begin the script code samples in this series with something like, #!/usr/bin/perl
To be able to understand this series, you should have professional knowledge in Perl and professional knowledge in MySQL, and database in general. You should also have professional knowledge in website design. If you do not have any of that knowledge, click the relevant links below (bottom of page) to have the knowledge first.
In each series you should read the parts in the order given. For each part, the links and order are in a menu on the (top) left of the page.
This series is the first series of my volume, Web Development with Perl and MySQL
The database resides in an Internet server. One of the databases used for web development is MySQL. Other databases like MSSQL, Sybase and Oracle can be used; but they are not free. MySQL is free. In this series I use MySQL 5.5; you can use a higher version if you want to.
A web page is the page displayed by the browser. The main computer language used to produce web pages is, HTML. You have other associated languages like, CSS and ECMAScript. You also have an enhancement to ECMAScript, called DOM. In this series, I use HTML, CSS, ECMAScript and DOM, for the production of web pages.
When data is sent to the database from a web page (browser) at the client computer, it goes to the server. At the server, it is received by a script first before being sent to the database. It is the script that has the capacity to interface the database. The reverse happens when data leaves the database to the browser at the client. Such scripts are called server scripts. A language for such a script is, Perl. In this series, I use Perl 5.18; you can use a higher version if you want to.
What the Client sends and what he receives
The client would normally click a link on his web page (or type a URL in the address bar and press Enter) or fill a form and click Submit. When this is done, information moves from the client computer to the server computer. In return, the client can receive a web page or a piece of text, from the Internet server. If it is a piece of text, then the technology called, Ajax, has to be used. I will not explain or use Ajax in this series. Ajax is explained in the course titled, Major in Website Design (see link below).
When a client fills a form in a web page and clicks the Submit button, the data of the form goes to the server as a set of name/value pairs. A pair consists of the name of the control field and the datum (singular for data) of the control. In the phrase “name/value”, name, is the name of the control and value is the datum of the field. The set of name/value pairs is called the dataset.
There are two common methods by which the dataset can be sent. These methods are called GET and POST. With the GET method, the information sent is something like:
The href value of a hyperlink can be coded in this form. That is why I said above that the client could send information to the server either by clicking a hyperlink or filling a Form and clicking its Submit Button. With the POST method for the Form, the information is coded and sent when the Submit button is clicked; you do not need to worry much how the POST method sends its data.
At the server, the server script receives the dataset, processes it, before sending the data to the database. We shall see how this is done with Perl later.
In order to use the database of must web development sites, you have to register as a member first, in the organization that has the database. Membership can be in many forms: a registered customer for an ecommerce company is a member. A member (reader or writer) for a social network, like this one; an email user for an email site like yahoo.com, are other forms of membership. A client needs a minimum of user name and password, to register as a member of a web development site.
Any web development organization deals with emails. To make things simple, let me talk here about email sent to the client when he registers. When the client registers, with his credentials, his credential data is recorded in the database. During registration an email should be sent to the client automatically, welcoming him to the organization. This email may indicate to him his privileges (rights) in the organization.
In most organizations, before a member can use a database, he has to login. Login involves filling a form with the user name and password in one of the sites web page. At the Internet host (server), the database server checks if the user name and password are for one person (and correct). If yes, the database server allows the user to use the database for one session. A session is the use of the site (database), continuously, for a short period of time. It can be 10 minutes, 20 minutes, 1 hour, 2 hours, etc.
At the end of the session, the client logs out by clicking a logout button (or link) in one of the sites web page. After logging out, the client can no longer use the database again until he logs in again.
Examples of Web Development Websites
Examples of Web Development Websites are email sites (e.g. yahoo.com), social networks and ecommerce sites. In fact, the project we shall carry out in this series is for a small ecommerce site.
At this point you have got an overview of Web Development. So, we stop here and continue in the next part of the series.
Related LinksWeb Development Basics with Perl and MySQL
Perl Validation of HTML Form Data
Page Views with Ajax and Perl and MySQL
Search Within a Site with Perl and MySQL
Web Live Text Chart Application with Perl and MySQL
More Related Links
PurePerl MySQL API - Free Download
Major in Website Design