tags:

views:

175

answers:

4

I am creating a website and done with some HTML stuff, but I am thinking to create site using CGI and Perl scripting. I don't have much idea on CGI scripting. Can anyone please suggest me how to create a CGI script and how to create web pages with that?

+2  A: 

CGI is a standard to interface a webserver and a content provider or external application (let's say a Perl script, a compiled program), I think you better study Perl to code some CGI.

This link is a beginner guide to get started with CGI coding in Perl.

Also if you are beginner in Perl you might look to some other scripting language more dedicated to web, the best example is PHP. But if you are already experienced Perl CGI, the CGI.pm is nice also.

RageZ
Tutorial is slightly outdated - no "use strict", no lexical filehandles, ...As for PHP - it should not be used by beginner because of serious style problems like mixing HTMl and code.
Alexandr Ciornii
Why learn a dedicated language? Perl (Ruby and Python, too) provides great tools for making websites, and they are also useful for general purpose programming tasks. Back when I was deciding what language to learn for web tasks, I chose Perl specifically because of its general usefulness for other tasks. This decision has paid off handsomely for me. IMO, the convenience of PHP does not outweigh its limited applicability. Also, that tutorial is more than a little dated, it talks about using a version of perl that dates from June 1997.
daotoad
you can do clean code in php, yeah most people are mixing too much HTML and PHP but the language don't force you. I mean PHP is more intuitive to a beginner and you can achieve stuff more easily then in perl. But it doesn't mean that perl or php is better just it depend what you want to do. In his case he seems to be a beginner so I don't know if perl is the easiest language to learn for a beginner. Just my thoughts
RageZ
@bian d foy thanks for the edits
RageZ
also last point you can do normal scripting with php as well ... it is not dedicated to web it just happen most of people use it only for web.
RageZ
+3  A: 

Have a look at A Beginner's Introduction to Perl Web Programming on perl.com.

I would recommend you make use of tools like Template Toolkit or Markapl to make the process of producing and maintaining your HTML view much simpler.

And moving forward you might want to consider looking at using a web framework ranging from something very light like Squatting to a powerful beast like Catalyst.

/I3az/

draegtun
A: 

As far as I understand your question, you say that you wrote your own web server and now want to implement CGI!?

These links should help you:

CGI Specification

How to implement CGI in a Web Server

Edit: Check the original question before downvoting me.

daddz
Question says he's "creating a website" and has done "some HTML stuff". There's nothing there to indicate that he wrote his own web server software and the reference to "some HTML stuff" strikes me as a rather strong argument against the idea that he's into this deep enough to have done so.
Dave Sherohman
With original I mean this one: http://stackoverflow.com/revisions/1437298/list
daddz
+5  A: 

Try Ovid's CGI Course - it's a good start. "A Beginner's Introduction to Perl Web Programming" is also a good reading, but with less information.

Later you can try framework like CGI::Application - it should be easy even for a beginner.

Alexandr Ciornii