BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan Right Header

HOME BZU Mail Box Online Games Radio and TV Cricket All Albums
Go Back   BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan > Welcome to all the Students > Articles > Computer & Programming


Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 23-09-2008, 10:38 AM   #1
Welcome to CGI
Waqas Ahmed Waqas Ahmed is offline 23-09-2008, 10:38 AM

Welcome to CGI for the Total Non-Programmer.

This tutorial will walk you through the basics of creating CGIs with Perl on a Unix platform. Unlike other tutorials I've read, this does not assume you know anything about CGIs, Perl, or Unix.
At the end of this tutorial you will be able to create Perl programs for counting hits, storing and retrieving guestbook information, and processing secure passwords. You will also gain an understanding of how the Perl programming language works, and you will learn to use variables, IF statements, and loops in Perl.

WHAT IS A CGI?

CGI stands for common gateway interface. Essentially, a CGI is just a program which runs on your server. It can be written in any programming language, so long as you can run it on your server. Perl has become a popular choice for CGI programming because it is available for all platforms, and it has many useful tools that are ideal for the web.
When I fill in a form on a web page and press 'Submit', 2 things happen on the server.
1. Everything I typed or selected is copied to the server.
2. The server looks for the program specified at the top of the form, and runs it.
The first thing the program will usually do is request the contents the web page form, and assign it to variables which it can use. Then the program is able to search a database or send an e-mail or add to a guestbook, or whatever you would like it to do.
As with the JavaScript tutorial, this tutorial will teach by example. For each new topic, we will examine the entire code, then break it down into small pieces and discuss the relevance of each line. Before you can use Perl on a Unix server, however, you will need to know a little bit about Unix.
THE UNIX ENVIRONMENT

You must have the ability to Telnet to your Unix server in order to create CGIs with Perl. Click here if you do not know how to do this.

You must have the ability to FTP documents to your server. You probably have already done this, as it is necessary to publish anything on the web.

There will be times when using Unix when it will seem that we have traveled 20 years back in time. The editors and commands are typed on a command line, as we did with DOS. Actually, Unix is by far the most powerful and flexible operating system available. When used at a local terminal, users use a graphic interface called X-Windows. X-Windows is too slow to use over the internet, however, so we will use the command line for the few Unix commands we need.
The command Prompt

Every time you enter a new line into Unix, you will get a command prompt. It often appears as your machine's name followed by a % or # symbol. This is where you enter your basic commands to create, copy, move, and delete files, among other things.

Try this exercise:
  1. Open your favorite Mac or PC word processor. As with HTML, use a simple editor which can save your code as plain text. Type the following line:
    This is a dummy sentence.
  2. Save the file as practice.txt
  3. Use your FTP program to upload practice.txt to your server.
    NOTE: You should always upload your cgi files as ASCII, not binary.
  4. Use your TELNET program to access your web server.
  5. LOGIN with your user name and password.
  6. Type ls and press [ENTER] (NOTE: use lower case, UNIX is case sensitive)
    The contents of your web server should list on the screen. You should see practice.txt in the list.
  7. Type pwd and press [ENTER].
    pwd stands for 'Print Working Directory'. The path from your server's ROOT directory to your current directory should be displayed. For example, my home directory is at /home/usr/robyoung/htdocs
  8. Type mkdir myfolder and press [ENTER].
    You have just created a new directory (folder) called 'myfolder'
  9. Type mv practice.txt myfolder/practice.txt and press [ENTER].
    This will move practice.txt into myfolder.
  10. Type cd myfolder and press [ENTER].
    You have changed to the myfolder directory
  11. Type pwd and press [ENTER].
    The path name now ends with /myfolder
  12. Type ls and press [ENTER].
    The contents of myfolder is displayed. practice.txt is the only thing in it.
  13. Type cp practice.txt copy2.txt and press [ENTER].
    You have made a copy of practice.txt called copy2.txt
  14. Type ls and press [ENTER].
    2 files are now listed.
  15. Type rm copy2.txt and press [ENTER].
    copy2.txt has been deleted.
  16. Type ls and press [ENTER].
    Only practice.txt remains.

__________________

Waqas Ahmed

---------------------------------------------------
My education, expertise and experience as follows:
MS (CS), M.Sc.(TS), CCNA, CCNP, RHCE (prepared),
HTML, XHTML, DHTML, CSS, Javascripts, PHP, MYSQL, WORDPRESS, JOOMLA, DRUPEL, PHPBB ETC..
Adobe Photoshop, FLASH.
VMWARE Server. Windows 2003 Server, Apache Server, Squid Server, etc.
You can also get training from any of above or gain services.
Mobile : 0313-7359605
Email : waqqas1@yahoo.com
Company : www.vision2define.com
http://bzupages.com/f2/aoa-760/

 
Waqas Ahmed's Avatar
Waqas Ahmed

Join Date: Sep 2008
Location: New-Multan
Age: 37
Posts: 297
Contact Number: 0321-7359605, 0313-7359605
Program / Discipline: MSTS
Class Roll Number: 07-22
Views: 2341
Reply With Quote
  #2  
Old 23-09-2008, 10:39 AM
Waqas Ahmed's Avatar

 
Join Date: Sep 2008
Location: New-Multan
Age: 37
Posts: 297
Contact Number: 0321-7359605, 0313-7359605
Program / Discipline: MSTS
Class Roll Number: 07-22
Waqas Ahmed will become famous soon enough
Default Re: Welcome to CGI

I will post next part in short !!!!!!!!!!!!!!!!!
__________________

Waqas Ahmed

---------------------------------------------------
My education, expertise and experience as follows:
MS (CS), M.Sc.(TS), CCNA, CCNP, RHCE (prepared),
HTML, XHTML, DHTML, CSS, Javascripts, PHP, MYSQL, WORDPRESS, JOOMLA, DRUPEL, PHPBB ETC..
Adobe Photoshop, FLASH.
VMWARE Server. Windows 2003 Server, Apache Server, Squid Server, etc.
You can also get training from any of above or gain services.
Mobile : 0313-7359605
Email : waqqas1@yahoo.com
Company : www.vision2define.com
http://bzupages.com/f2/aoa-760/
Reply With Quote
Reply

Tags
cgi


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Best view in Firefox
Almuslimeen.info | BZU Multan | Dedicated server hosting
Note: All trademarks and copyrights held by respective owners. We will take action against any copyright violation if it is proved to us.

All times are GMT +5. The time now is 12:28 PM.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.