Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 14th, 2008, 10:07 PM   #1
Swan
Newbie
 
Join Date: Jan 2008
Posts: 23
Rep Power: 0 Swan is on a distinguished road
.cgi Vs .pl

What's the difference between cgi and perl. I am confused between the two. The file with ext .cgi is using the perl code. It runs too.
But the file with ext .pl , and containing the perl code doesnot run ? What's it's significance.
Swan is offline   Reply With Quote
Old Jan 14th, 2008, 10:33 PM   #2
mbd
Programmer
 
Join Date: Nov 2007
Posts: 74
Rep Power: 1 mbd is on a distinguished road
Re: .cgi Vs .pl

file extensions are mostly meaningless. windows maintains a map between file extensions and the programs which should be used to open them. apache web server does something similar. CGI is an interface agreed upon by rfc 3875. it is used to pass information from web requests to executables. CGI can pass data to any type of executable which can understand it. your .cgi files are probably parsed for a #! line which maps your particular .cgi file to be executed by perl. in short, file extensions are pretty much meaningless.
mbd is offline   Reply With Quote
Old Jan 15th, 2008, 2:00 AM   #3
Mocker
Hobbyist Programmer
 
Mocker's Avatar
 
Join Date: Oct 2005
Location: Indiana
Posts: 199
Rep Power: 0 Mocker is an unknown quantity at this point
Send a message via AIM to Mocker
Re: .cgi Vs .pl

The extension just tells the server how to handle it. cgi extensions tell it to run the script with whatever program is listed at the top #! line. If the server is not told to do the same with .pl files then it will not know what to do with it.

If you are on an apache server, adding this line to the .htaccess file in the folder will make it parse .pl files through CGI
AddHandler cgi-script .pl
__________________
#programmingforums relay - http://thegupstudio.com/cgi-bin/pforelay.cgi
freelance scripts - http://ryanguthrie.com/index.html
Mocker is offline   Reply With Quote
Old Jan 16th, 2008, 11:57 PM   #4
Swan
Newbie
 
Join Date: Jan 2008
Posts: 23
Rep Power: 0 Swan is on a distinguished road
Re: .cgi Vs .pl

Actually I am not able to run test.pl ( in cgi-bin/test.pl). However files with .cgi run successfully. So should i rename test.pl to test.cgi. Is CGI file and Pl file one and the same. ?
Swan is offline   Reply With Quote
Old Jan 17th, 2008, 12:22 AM   #5
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,724
Rep Power: 5 Sane is on a distinguished road
Re: .cgi Vs .pl

The fact that the .pl extention does not work, would be the result of Apache's configuration. It is not currently set up to recognize the .pl extention as a valid cgi-script. This configuration is controlled in the httpd.conf file.

For now, if you use the .cgi exention, and link the file to the Perl interpreter with the proper Shebang (#!), it should work fine.
Sane is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:10 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC