Thread: Newbie Question

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Location
    Montreal, Canada
    Posts
    72
    Rep Power
    15
    Hello People,

    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.
    http://www.igboryders.com
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    4
    Rep Power
    0
    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.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Location
    Montreal, Canada
    Posts
    72
    Rep Power
    15
    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.
    http://www.igboryders.com
  6. #4
  7. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    >>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).
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    2
    Rep Power
    0
    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)
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    0
    Rep Power
    0
    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..

IMN logo majestic logo threadwatch logo seochat tools logo