Discussion Locked

perl path?

0 helpful
9 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I've decided to learn perl and try to get some scripts up and running. However, I've fallen at the first hurdle.
Can anyone explain what the perl path is. I've been given the folling information but it means absolutely nothing to me
the server's Perl path?
#!/usr/local/bin/perl

Sendmail is located?
/usr/sbin/sendmail
If I want to install a perl script
Do I type in the above exactly as it is written word for word or does it mean eg: usr = http://www.my.homepage.com etc,etc.

9 replies

by epepke

The #!/usr/local/bin/perl is called the "shebang" line, and it's included so that a UN*X system can run the script directly from the command line. You also have to make it executable. You also have to make your sysadmin enable that feature.

I think you're trying to bite off more than you can chew at this point. Assuming that your perl is located in /usr/local/bin, you can run a perl script (named "script") by typing

/usr/local/bin/perl script

As for sendmail, it's very useful, but I think you need to work some more with perl first.

Perl scripts aren't really "installed"; they're just there. Perhaps you are talking about using one as a CGI script. Again, play with Perl first before getting involved in complexities like that.

Keep it simple for now.

by semcclure98

Get the book Sams teach yourself Perl.
Download the perl scripting tool from
http://www.perlscriptingtool.com/pst/
it is freeware and you can test scripts before you upload them.

Most servers have you put perl scripts in the cgi-bin.
Make a cgi-bin, upload your script to it,
change mode to 755 and then type
the address of the script into your browser.

by dam-it1

Thanks for all the advice. After carefully reading all the replies and following your advice I now know that the problem is my knowledge (or lack of it) on unix/apache web servers and not perl or cgi.
Thanks again for the help.
Can anyone point me to some good unix resources?

by gjohnson

Sounds like you are contemplating using Perl to access sendmail on your NIX box. Any time you use Perl to call other processes, you should make REALLY REALLY sure that you know what you are doing. Get the O'Reilly Camel or LLama book (learning Perl) and see what they say about removing evil characters. If you call sendmail in your cgi and pass it characters that users type in to a web form, bad people will pass evil characters in to execute arbitrary code on your computer. This is a very negative event. You can avoid it by using good programming practices. Read up on CGI security before cranking out cgi scripts.

Just my two cents.

Geo

by dam-it1

After following the instrutions posted and linking to the sites, I can now run cgi scripts. (it's easy!!) ;) Thanks to all who contributed. It's nice to know there's a place to go where experts offer usefull advice to novices. Keep up the great work.Thanks a million!!
If anyone is interested, I was uploading the scrips in binary instead of ASCII, also I did not change the file permissions, among other silly things that I done. My main problem was my lack of knowledge of unix commands. Perhaps the best help site I found was http://www.lies.com/begperl/ Great for the complete novice. Thank You Again.

This discussion is closed to new replies.