November 23rd, 2000, 07:58 PM
I have been using perl for a while but my limit is only to customizing already written perl script. I saw the tutorial on perl on the front page of devshed.com and I decided to start writting my own perl scripts. The only problem is that I don't know how to run the scripts. Do I save the file with a .pl extension or .cgi? Do I have chmod any files or directory. In short, how do I execute the scripts. Thanks for the help in advance.
Visit my PHP V-Portal.
November 24th, 2000, 05:23 AM
I guess that you are running a linux/unix machine...
The most common extention is .pl I think, so you can name your scripts that, i e fun_script.pl.
Then you probably should run chmod 755 fun_script.pl (to make the script accessible).
From that point you can access the script from the Net, or run it on your local machine by writing perl fun_script.pl.
November 24th, 2000, 10:01 AM
Thanks, one more question. Do I have to chmod the directory. And yes, I am working on a unix box.
Visit my PHP V-Portal.
November 24th, 2000, 10:27 AM
>>Do I have to chmod the directory
By default, no. It depends on whether you are testing your scripts from your own box or hosting it somewhere.
If Apache is run as nobody, then that directory needs to be 755 (drwxr-xr-x).
November 25th, 2000, 02:58 PM
Well, I would save it as a .cgi file. This is if you want to put these scripts on the web. If you're just making scripts for your own personal use, .pl is fine....
If you will be publicly using these scripts, save them as your_file.cgi
Then, once you've saved it, you need to go to your Unix and enter chmod 755 your_file.cgi
The first digit (7), is what permission the owner of the file has, the second digit (5) dictates what permission the group that the owner belongs to has, and the third (5) dicatates what permissions everyone else has. Read permission is 4, write permission is 2, and execute permission is 1. So, 7 means you can read, write, and execute the file (4+2+1), and 5 means you can read and execute it (4+1)
November 27th, 2000, 12:51 PM
one difference on my server is file.pl will only run in the cgi-bin but file.cgi will run in any directory... i dont know if this is unique just on my server..