First of all, the perl source code I have is in a .txt file. I understand I have to rename this as a .pl file - is that right?
Second of all, where do I upload the file to? Should it belong in a specific directory (okay, it doesn't matter, I know, but are there standard practices? What on earth is a cgi-bin, and why don't I have one on my server?)
Third of all, though I implore him for the love of God, my service provider is still hanging on with a Windows server. This cripples me from doing all sorts of things that I'd like to - not least using php, mySQL, using chmod, .htaccess etc. Does this also mean I can't use Perl? (I gather that in most cases I still can...)
Fourth, what's this thing with setting permissions so my server can execute the code? If I can't do that with my ftp client, can I do that with raw ftp? If so, how?
Thanks, so much, in advance.
1) Your perl file must have a ".pl" or ".cgi" extension. It can actually have any extension you please, but your server must be configured to regard that extension as a perl file. Here's another way of looking at this... when you click on a .doc file on a Windows computer (which is an MS-Word file) Windows automatically knows to open it with MS-Word. On the other hand, when you click on a .dba file (that's something I just made up) Windows will ask you which program you'd like to use to open it with--because it doesn't know what to associate the file extension with. So again, your server must be configured to open a certain file extension with a certain program.
2) You upload the file to the cgi-bin directory, on most servers. The cgi-bin directory is nothing more than a directory that's configured to execute perl scripts. You can run your scripts from any directory, as long as it's configured to execute perl scripts. I actually run my perl scripts from a "prgs" directory, because I think it looks a little classier than the typical cgi-bin directory.
3) Windows servers can be setup to run Perl scripts. My Windows server is setup to run Perl Scripts, though I host the websites that use Perl on my Unix server, because Unix just seems to be better for Perl... Perl was originally designed for Unix, and Perl excecutes more quickly and efficiently on Unix.
But anyways, your webhost's computer may also be setup to run Perl. You should talk to him/her and tell him that you'd like to use Perl scripts, because he/she will probably have to configure a cgi-bin directory for you. That is, if Perl is installed and configured on the server. If not, I'd recommend that you find a different host, or maybe talk to your provider about installing Perl. It's easy to setup and doesn't use much in the way of system resources.
4) You can change your file permissions with an FTP client. At least if you're using a decent FTP client you should be able to. And, you do need to change your Perl files' permissions to execute. I usually do this on owner, group, and other/public.
Here's an FTP client that allows you to change file permissions:
[smartftp.com...]
This is a decent free FTP client. Don't let the name fool you though-- it's not all that smart. I don't trust the program to discern between ascii and binary files. I usually keep it at ascii transfer mode and manually change it to binary whenever I'm transferring binary files.
Also, if you're serious about Perl, here's something else that would be of use to use:
[dzsoft.com...]
I'd recommend getting the Perl editor here. It's the one I've been using for over a year now. It allows you to edit Perl files and actually execute them on your windows computer. It has a syntax check, too. Very nice program for only $30.
Finally, if you're serious about Perl, a great beginner's book is "Perl and CGI for the world wide web". This will answer most of the questions you'll have as a perl beginner.
Good luck,
Gregg
I'll give my service provider a call and get cracking.
I also found this on the web, which might be a good entry-level Perl tutorial for anyone else who is in the same position as me, right now.
[cgi101.com ]
Or for $0.00 you can download the Activestate distribution and use any text editor to run perl on Windows...