HI. I created two files ‘hello.pl’ and ‘hello.cgi’ with the code below.
#!/usr/bin/perl
print "Content-type:text/html\n\n";
print "hello world";
I can view the page via both
http://www.mydomain.com/cgi-bin/hello.pl
and http://www.mydomain.com/cgi-bin/hello.cgi.
Which one is more sense in Perl web dev?
BTW, the directory of ‘cgi-bin’ created by my VPS server, Do I need contact with my VPS support to remove it or just remain it like this URL style? Maybe http://www.mydomain.com/perDev/hello.cgi is better?
It doesn’t really matter which extension you use. You could configure your server to treat
.potatoas a CGI file if it pleases you.My personal preference would be to use
.cgior even no-extension at all if it will work. The main reason for that is you give out a bit less information to anyone who may wish to attack your script. It’s a minor thing–don’t rely on this as a security measure. This is a chicken-soup security precaution (it can’t hurt).The benefit of not using
.plis so slight that you may decide to use.plfor the simple fact that it is shorter, and it would still be a good enough reason as far as I am concerned.Do whatever pleases you.