Great Templates

FEATURED WEB TEMPLATES

Amazon Books

Learn PHP

PHP Training
Zend Cert Training Zend Certified Engineer Zend PHP Pro

Perl: How To Create A CGI In PERL

You can create CGI in Perl by "Content-type:" statement;
eg :-
print "Content-type: text/html \ n\ n";
print "< TITLE> TEST PROGRAM FOR CGI \ n";

How to extract Form variables in a perl CGI program ?
There are many perl library file that can be used.
eg :- "cgi-lib.pl" or some other ones you could get.
A CGI example :

require "cgi-lib.pl";
&ReadParse;
name=$in{\'namebox\'};phone=in${\'phone\'};
print "Content-type: text/html \n\n";
print "< H3>Thanks $name; we may contact you at $phone < /H3>\n";

*Note here the HTML Form\'s textbox (namebox and phone) values are extracted into variables using the perl library funcions. The Enironment variable contains the HTML Form\'s submited data which are passed as a single line of text to the CGI program.

How to show Pre-Formated data in a browser from a CGI ?
You can use "< pre>" and "< /pre>" tags.
eg :-
print "Content-type: text/html \n\n";
@files=`ls -l`;
print "< pre> \n";
print "@files \n";
print "< /pre> \n";

*Note: The file name must have ".cgi" extension.

 

 


Learn PHP | Zend Certified Engineer | Zend PHP Pro | PHP Web Apps | Web Hosting Service | Low Cost Domain Names | Great Templates | Great Books | Testimonials | Tech.Articles | TOS | AUS | Home | Linux Apache MySQL PHP