Showing posts with label CGI. Show all posts
Showing posts with label CGI. Show all posts

Thursday, February 18, 2010

Who says CGI/PERL is obsolete?

Some say CGI/PERL is slow.
Some say CGI/PERL has security problem.
Some say CGI/PERL is phased out by PHP.
...

But there is still one "BIG" website that is still using CGI/PERL until today. Have you seen this:

https://www.paypal.com/my/cgi-bin/webscr

If CGI/PERL is not good, why is PayPal still using it until today to deal with large sum of credit everyday?
UPDATE (April 4th, 2016): It has been six years since I posted this comment about PERL's popularity. But I now would say PERL is already obsolete for me as PHP is far well supported by the developer's community. PERL's support doesn't seem to exist anymore as most developers are now using PHP as their favorite scripting software running on the server side. Whether Paypal is still using PERL, nobody knows as it is important for website like Paypal to refrain the visitors from knowing the type of scripting language it is using. Even the question now is whether PHP will be phased out by free online web editors such as Wordpress, Drupal and Blogger.
Read More »

Tuesday, February 16, 2010

Speeding Up PERL in CGI Output

Usually I will do the following setting:


select(STDOUT);
$| = 1;
print "Content-type: text/html\n\n"; # whenever your browser sees this, it will blank the screen
$| = 0;


$| = 1; is to make sure to send data to client web browser immediately. It is like a "live" connection.

$| = 0; is to make sure to send data to client web browser only when the buffer is filled.

Such configuration can make the user feel that the response of the web is fast but it is actually just slightly faster.

If you use $| = 1; throughout the HTML code spitting process, your web can be slower as it is wasting the buffer and burst capability of TCP connections. Unless you want to have live output capability such as the ping result from the server, avoid setting it to live output mode.
Read More »

Friday, January 22, 2010

Direct Download Link with PERL - CGI

There are times that you need to make sure you record or filter before your visitors download your files. Here are codes if you are running CGI using PERL:


open(FILE, "../file/$fn"); #file is the directory and $fn is the filename
@file=<FILE>;
close(FILE);

print "Content-Type:application/x-download\n";
print "Content-Disposition:attachment;filename=$fn\n\n";
print @file;



Note that you don't need to print the html header :"Content-type: text/html\n\n" before this. You can also add the Content-Length header so that the browser know the size of your file but the size has to be accurate to avoid error.


Read More »

Wednesday, January 20, 2010

PHP vs CGI - PERL vs ASP

What a strange round-up comparison.

I like CGI - PERL combination because Linux server is free to set up if I want to build my own web server. PERL is much powerful than ASP after comparing both programming platform. Many tasks can be completed with minimum amount of codes compared to ASP. Anyway, ASP is obsolete and ASP.NET is just as versatile as PERL programming environment.

I like PHP as it is like the combo of PERL and ASP. It has the server side thing as well as the PERL programming flexibility.

As for ASP, I don't see much benefit of using it beside its ability to make use of default.asp similar to index.html to save user from typing the URI. Calling the root directory is sufficient to run the web site. This is briefly explained in my second post on the 2nd of January 2010.

In conclusion, all three are acceptable to be used as your website programming platform. It is up to you to decide. If you are running a Windows server, you seem to have not much choices. If you are using a Apache based web server, you get to choose either PHP or PERL. Actually I like PERL a lot as it is way flexible and versatile but the /cgi-bin/ path showing on the web address is just too risky and it is too inviting to hacker's attack. Hackers instantly know what you are up to. PHP could be the most popular and hassle-free web programming environment. With the support of free database softwate, MySQL, to run database, it is like a gift to web programmers.




Read More »