1 / 12

Introduction to CGI/Perl

Introduction to CGI/Perl. Please use speaker notes for additional information!. First.cgi. This is the shebank line. It contains the sharp symbol (#) followed by the bang symbol (!) and then the location of the Perl interpreter on the system that you are using.

tauret
Download Presentation

Introduction to CGI/Perl

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to CGI/Perl Please use speaker notes for additional information!

  2. First.cgi This is the shebank line. It contains the sharp symbol (#) followed by the bang symbol (!) and then the location of the Perl interpreter on the system that you are using. Perl comments begin with the sharp symbol (#). #!/usr/bin/perl #first.cgi print "Content-type: text/html\n\n"; #generate HTML print "<HTML>\n"; print "<HEAD><TITLE>First Script</TITLE></HEAD>\n"; print "<BODY><H1 ALIGN=CENTER>Hello World!</H1></BODY>\n"; print "</HTML>\n"; The print function specifies that the type is text/html because this code sends an HTML document. The rest of the prints are sending the HTML which will be run.

  3. First.cgi The -c switch tells the perl interpreter to check the syntax of the script.

  4. First.cgi You can see the HTML script that was generated as a result of using the -w switch with perl.

  5. First.cgi Note that first.cgi is in the director C:\perl\bin which also contains the perl executable.

  6. First.cgi Now I have uploaded first.cgi to my host and stored it in the directory named cgi-bin.

  7. First.cgi This is the first.cgi script that I uploaded in the previous slide.

  8. First.cgi

  9. First.cgi Note that it says: http://www.pgrocer.net/cgi-bin/first.cgi

  10. First.cgi Note that the source is the same code that was put into the script. #!/usr/bin/perl #first.cgi print "Content-type: text/html\n\n"; #generate HTML print "<HTML>\n"; print "<HEAD><TITLE>First Script</TITLE></HEAD>\n"; print "<BODY><H1 ALIGN=CENTER>Hello World!</H1></BODY>\n"; print "</HTML>\n";

  11. First.cgi

More Related