PERL PRIMER 3.
TOPICS COVERED IN THIS PRIMER:
- Unix file permissions.
- FTP uploading notes
UNIX FILE PERMISSIONS.
Before we get ahead of ourselves.. I should explain Unix file permissions a little first. Thats the other biggest cause of problems when running Perl scripts.
Most of you are familiar with Win9x (Win95, 98 and ME) and Win9x has no file permissions as such. If its there, and its a script you can run it, this is not so with Unix..
As a security measure, Unix based systems, (and Win2000 and XP to a degree now as well) have file permissions, basically this means that if you "own" a file, you can give or take away the rights of other users to read, write or execute your file.
It breaks down to 3 permission areas, like so:
Owner. Group. Everyone else.
So you can set permissions for yourself, anyone in your user group, and for anyone else...
The permissions add up to a total of 7 for each item... and the breakdown looks like this:
1: Execute. 4: Read. 2. Write. ---------- equals 7Now taking that into account, 777 means that you as the owner (7) everyone in your group (7) and everyone else (7) can read, write and execute the file.
A permission of 755 means that you as the owner (7) can read, write and execute the file. the group and everyone else, can read and execute, but not write. (5)(5). (755 is usually the permission level you should set perl scripts to...) 644 is the usual permission for a html file on a host. that means the owner (6) can read and write the file, but the group, (4) and anyone else (4) can only read it. (no-one can execute it)
The command to change file permissions on a unix server is "chmod" so here is an example:
chmod 755 hello-world.pl
We have just made this file executable. If you don't have access to telnet or ssh (secure telnet) you can change the permissions by using your FTP client application, ususally by right clicking on the file on the server, and selecting "properties" or "permissions" will bring up a box where you can set them in much the same manner.
So, now you know how to make sure the path to perl is correct, and how to make sure the permissions are set correctly.. the only thing left to mention before we start with a basic script is uploading files..
FTP UPLOADING NOTES
ALWAYS upload your perl scipts in ASCI.. check your FTP program, it usually has three upload methods.. ASCI, Binary, and AUTO. binary is for compiled programs, images etc.. ASCI is for text files, and text files are what perl scripts really are. Auto is usually some method that the FTP program will try to work out which type the file being uploaded is. don't trust AUTO, it will occasionally get it very wrong.
Uploading an ASCI file as a binary will result in it not working and you'll get an unexplained: "Server 500" error message in the browser when you try and run it, so make sure you tell your ftp program to upload as ASCI.
This site is totally free to use, you have absolutely no moral or legal obligations to help us continue.
There are however, some costs involved in running the site.
So if this site helped you find your way,
perhaps you could consider contributing to our costs.
Whatever amount you feel this site was worth to you would be just wonderful.
Use PayPal if you do decide to share and help us with the costs and in appreciation for our time and attention, or alternatively buy a book from our Bookstore..
Time in Don's part of the world is: Sun, February 17, 2019 at 7:52 PM
Time in Franki's part of the world is: Monday, February 18, 2019 at 08:52 AM
Don't worry neither one sleeps very long!