CGI essentially supports any language and can be used on pretty much any platform you like. Whilst Perl is perhaps the most common CGI language you can also use C, C++, Ruby or Python. CGI is often thoguht of as being a Unix thing, but in fact pretty much every web server supports it, including Microsoft.
ASP stands for Application Server Pages and is a Microsoft proprietary technology which whilst being well supported on the Microsoft web server it is only poorly supported on other servers and platforms.
CGI and Perl have a great relationship with some of the largest websites around being based on that technology. The lines are blurred a little these days with Perl being avilable as an integral part of the Apache server by way of mod_perl. There is a huge array of support and many complete applications. CGI/Perl is capable of pretty much anything any other programme can do, database access, external device control, talking to other programmes, you name it. Part of this is due to the fact that Perl is in fact an extremely capable general purpose computing langauge, whereas ASP is a specific Web based scripting environment which does not have the same broad support or capability.
jdtoronto | [reply] |
This may sound a little pedantic, but the benefit of CGI over ASP is that you can execute a program and send submitted form data to it. The benefit of CGI over Perl is exactly the same - except you're using Perl rather than ASP. PHP, ASP, Perl, Bash, etc, all use the CGI.
This rather quaint definition (not updated since 1999 explains the core idea. If you read the specs (and I do think it is worth it - to gain a better understanding of what the CGI actually is), you'll see that it basically says what environment variables get set by the server when processing an HTTP request through the CGI. I'd also recommend you read up on HTTP - if only so that when things go wrong you'll have a pretty good idea where to look first.
Whether you should use Perl or ASP is up to you. What have you used before? If a server hasn't been bought yet, which do you feel more comfortable working on? If not Windows, ASP is a silly option. Is budget an issue? Perl can score there if you also feel comfortable with Apache - especially if on *nix.
| [reply] |
Perl-cgi has a longer history, and has been more robust than ASP (how many times have you seen an ASP error message when using a website?).
In general ASP is easier to get started with, but Perl-CGI will take you farther, and gives you access to many more pre-written modules.
ASP forces you onto the Microsoft platform. Perl-CGI is flexible and will run just about anywhere. | [reply] |
We use CGI and Perl in an otherwise totally Windows-environment, so don't let anyone tell you that CGI and Perl is better suited for *NIX environments.The CGI protocol doesn't care what kind of program will execute behind it, that's why it is called the Common Gateway Protocol!
CountZero "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
| [reply] |
You can write CGI in any (for varying values of 'any') language. But with Activestate Perl, you can write your ASP in Perl, if you wish.
I find that most Perl people are Unix people and Free/Open Source Software people. This is a good and wonderful thing, but it means dealing with anything Microsoft is bad. There are worse things than Microsoft -- I'd work with VB anytime before I touch Tcl again -- so I'll put aside those feelings and get directly to a practical place.
Which is, ASP follows a PHP-like stance of putting the code within markup (lead the way, actually, but you get my point), while CGI puts the markup within code. So, if we were to build a 10x10 multiplication table, it'd be something like this in CGI/Perl: print qq(<table>) ;
for my $a ( 1 .. 10 ) {
print qq(<table><tr>) ;
for my $b ( 1 .. 10 ) {
my $c = $a * $b ;
print qq(<td> $c </td>) ;
}
print qq(</tr>) ;
}
print qq(</table>) ;
While something about the same in ASP would look more like this, although it's more PHP-ish and pseudocode: <table>
<? for my $a ( 1 .. 10 ) { ?>
<tr>
<? for my $b ( 1 .. 10 ) { ?>
<td><? ($a * $b) ?></td>
<? } ?>
</tr>
<? } ?>
</table>
You can do interesting things in the Visual-Basic-like Microsoft languages. I have. Writing them isn't nearly as pleasurable as writing them in Perl, which is why I'm not a VB-monk, assuming any such thing exists. But if you want the code-within-markup experience, and you have a Unix/Linux server around, PHP would good (and cheaper than MS licenses) solution. And there might be Perl things that do it, too, but I don't know of anything.
| [reply] [d/l] [select] |