Help with a Perl script

Not sure if anyone uses Joomla, but I have just downloaded a Amazon Product Feed (APF) from Mr. Rat (

I’m not familiar at all with PERL or even how to set it up thru the Dreamhost network. The instructions he gives are pretty thorough but there are two issues I have with them that I need further help with understanding what I am actually looking at and what all this means. Here are my two problem areas that I am not sure if I need to modify or how to get to.

1)Edit the Script if Needed

There is one thing that you might need to change in order for the script to run correctly for you.

To edit the script, open it in a text editor that understands Unix type line endings. HTML-Kit works great for this and is what I use to write the script. It looks a bit more complicated, but has some features that make it much easier to edit scripts like this (such as color coding elements). Now that you have it open don’t be scared, you only have to change one thing. [NOTE: I HAVE GOTTEN THIS FAR]

The very top line should look like this:
This tells the script where to look for your Perl directory. This is the most common location of Perl for most servers, you should be able to find this out from your hosting. If yours is different, simply edit it in the script. Like this:

Only change this if it is different for your server, if it is the same, leave it like it is. This is the easiest way to break the the script so if you don’t need to edit it, DON’T.


Connect to your website in the FTP Program and double click on your cgi-bin folder (you may need to open the public_html folder first, depends on server).[NOTE: This is probably where I am having the most trouble. I cannot find the public_html folder on my FTP server, and don’t know where the cgi-bin would be anyways that I need to upload the files into]

On the bottom of the 2 windows you will see 3 options
ASCII Binary Auto
Make sure that you select the ASCII options or the Amazon Products Feed will not work.

Next, navigate through your computer files and find where you saved the folder you unzipped a minute ago. It should be named
Next upload it to the server by clicking the folder, then click the right arrow in between the two windows. WS_FTP LE will ask “Do you want to transfer selected folders and their contents?” click Yes.

Now you have the script installed on your server, you need to change a couple settings

—Any help would be greatly appreciated. Thanks in advance. And I’m very green at this, so I’ve installed my flame-retardant protection. :slight_smile: Thanx!

number one is already correct - that’s the location of perl on DH servers.

As far as public-html that would be your folder. The content in that folder is web-accessible. You don’t need a cgi-bin - any file ending in .pl or .cgi will automagically be parsed by perl. If it makes things easier you can create a cgi-bin inside your folder.

(you normally won’t find any flames here)

*EDIT: Rlparker has provided a much more indepth answer below, though we both say exactly the same thing. Must be good advice then :slight_smile: .

–Matttail - personal website

Those are both reasonable questions for someone new to perl, or to Dreamhost. Fortunately, there are “easy” answers :wink: :

  1. On DH , if you look for the path to perl via the “which perl” command from the shell, the path to perl is reported as being /usr/local/bin/perl, so the authors notes in the instruction about editing the script to change that first line (the “!” or the “shebang” line) would seem to be indicated. That said, according to the DH Wiki article on Perl, /usr/bin/perl also works, so you do not need to change that part of the script.

  2. The “public_html” folder is a common convention used to indicate where your web-accessible files are stored on a web server (as is htmldocs, www, etc - depending upon the host), and older DH accounts were actually configured this way once. Now, however, unless you change the defaults when “adding” a domain via the DH control panel, DH uses the name of your domain (yourdomainname.tld) as the directory name for your web accessible files (the equivalent of public_html). That said, wherever the author of the documentation refers to “public_html”, you should just use the directory that is the “root” of your domain for that location (unless you have changed it, it will be “yourdomainname.tld”).

Cgi-bin is generally a “special” directory from which “CGI binary” files are served, and it usually has special characteristics and security features; this is why the author wants you to use the cgi-bin directory for installing his program. However, on DH, since DH uses suexec to run CGI programs as your user, rather than as the user running the webserver, a cgi-bin directory, per se, is not really needed at DH, and one is not provided “by default”. You can run CGI programs from any web accessible directory on DH (it doesn’t have to be cgi-bin), but in order to make your life simpler , and be able to use the author’s instructions “as is”, the easiest thing to do is to just create a directory in your “yourdomainname.tld” directory named “cgi-bin”, and use that one as instructed by the author (as though it was already there!)


EDIT - Oops! mattail was faster (and less verbose :wink: - Sorry for the “What he said” post; we were typing at the same time.)

Thanks for the help Mattail and rlparker… you guys REALLY make this easier with the short form fix (Mattail) and the actual long-form answer (rlparker). Thanks a ton… I’m getting it done now!