willyb21 has asked for the wisdom of the Perl Monks concerning the following question:

My boss wants me to set up a webstore on our intranet to show the marketing dept. what can be done. My problem is that I have never used perl or cgi to build a website. I always used straight HTML. He gave me the CGI/perl Cookbook which contains a webshop and all I need to get it up and running. I have until Wendsday the 13th to have something to show the managers. I think I have followed every step in the book and in the help section at the Perl website, but I cannot get the button to link to the cgi script. I get a page not found 404 error. Below is the first part of the webshop CGI and the config. txt files. We are running a windows 2000 server machine using IIS and indigo perl which uses Apache. please look at my code and help me find my mistakes. Thanks
#!/usr/local/bin/perl ###################################################################### +###### # + # # WebShop Version 1.5 + # # Written by Matthew Wright mattw@worldwidemart.com + # # Created 7/12/96 Last Modified 5/2/97 + # # + # # Copyright 1997 Craig Patchett & Matthew Wright. All Rights Reserved +. # # This program is part of The CGI/Perl Cookbook from John Wiley & Sons +. # # License to use this program or install it on a server (in original o +r # # modified form) is granted only to those who have purchased a copy of + The # # CGI/Perl Cookbook. (This notice must remain as part of the source co +de.) # # + # ###################################################################### +###### ###################################################################### +###### # Define configuration constants + # ###################################################################### +###### %CONFIG = ('recipient', '', 'subject', '', 'email', '', 'name', '', 'address', '', 'zip', '', 'field_names', '', 'sort', '', 'print_config', '', 'env_report', '', 'redirect', '', 'required', '', 'error_html_template', '', 'success_html_template' +, '', 'email_template', '', 'reply_message_template +', '', 'reply_message_attach', '', 'reply_message_subject' +, '', 'reply_message_from', '', 'log_template', '', 'log_filename', '', 'log_fields', '', 'log_delimiter', '||', 'log_uid', '', 'blatemail', '', 'mail_list', ''); # $CONFIG_DIR is the full path to the root directory under which # configuration files must be stored. It should end with a directory # delimiter $CONFIG_DIR = 'C:/indigoperl-5.6/cgi-bin/webshop/';C:/indigoperl-5.6/h +tdocs # $WEBSHOP_CGI_URL is the URL of this CGI script. $WEBSHOP_CGI_URL = 'http://192.168.0.14/C:/indigoperl-5.6/cgi-bin/webs +hop.cgi'; # $WEB_SERVER is the host name of your web server. If the name of you +r web # server is host.xxx, set this to 'host.xxx'. $WEB_SERVER = '192.168.0.14'; # $SMTP server is the server name of your SMTP server. For example, i +f # your service provider is host.net, try setting this to host.net or # smtp.host.net $SMTP_SERVER = 'mail.herb-pharm.com'; # This is the directory for lock files to be stored. It is recomended + that # this be set to /tmp if you are on a Unix system or some place outsid +e of # the web server space. $LOCK_DIR = 'c:/indigoperl-5.6/htdocs/tmp/'; # This is the maximum amount of time the CGI script should wait before + it # returns an error that it could not lock the file. $MAX_WAIT = 5; # $REQUIRE_DIR is the directory in which all of your required files ar +e # placed. On most systems, if ou leave the required files in the same # directory as the CGI script, you can leave this variable blank. # Otherwise, if you move the required files to another directory, spec +ify # the full path here. $REQUIRE_DIR = 'c:/indigoperl-5.6/cgi-bin';
Config.txt
# Data File Variables $DATABASE = 'c:/indigoperl-5.6/htdocs/database.txt'; $MAX_MINUTES = 15; $PRODUCT_INFO = 'c:/indigoperl-5.6/htdocs/products.txt'; $TAX_TABLE = 'c:/indigoperl-5.6/htdocs/taxes.txt'; $SHIPPING_TABLE = 'c:/indigoperl-5.6/htdocs/shipping.txt'; # Page Template Variables $BASE_PRODUCT_PATH = 'c:/indigoperl-5.6/htdocs/'; $INTRO_HTML = 'c:/indigoperl-5.6/htdocs/feedback.htm'; $REVIEW_TEMPLATE = 'c:/indigoperl-5.6/htdocs/feedback.htm'; $INVOICE_TEMPLATE = 'c:/indigoperl-5.6/htdocs/invoice.html'; $FINAL_TEMPLATE = 'c:/indigoperl-5.6/htdocs/final.html'; # Email Variables $EMAIL_TEMPLATE = 'c:/indigoperl-5.6/htdocs/feedback.txt'; $ORDER_SUBJECT = 'FeedBack Information'; $ORDER_TO = 'eagle5@cdsnet.net'; $CC_ORDER = ''; $REPLY_TEMPLATE = 'c:/indigoperl-5.6/htdocs/feedback.txt'; $REPLY_SUBJECT = 'Order Confirmation'; $REPLY_FROM = 'Herb Pharm <wbishop@herb-pharm.com>'; 1;

Replies are listed 'Best First'.
Re: cgi Beginner
by Mr. Muskrat (Canon) on Nov 07, 2002 at 20:24 UTC
Re: cgi Beginner
by FamousLongAgo (Friar) on Nov 07, 2002 at 20:29 UTC
    This URL in your code looks suspicious to me:

    http://192.168.0.14/C:/indigoperl-5.6/cgi-bin/webshop.cgi
    You seem to have a full path for your CGI file in there, which won't work. You need to find out what the root directory is for IIS CGI scripts, and amend the URL. For example, if IIS uses C:\WebRoot\cgi-bin\ as its root directory, and you put the file 'webshop.cgi' in there, your URL will be:

    http://192.168.0.14/cgi-bin/webshop.cgi

    You should be able to find this information in the IIS configuration panel, or the docs. Any IIS monks who can help?
      I don't know if I'd consider myself an IIS monk, but I definitely have to deal with it on a daily basis at work.

      IIS' default web root directory is C:\Inetpub\wwwroot. If not, go to Internet Services Manager in your Administrative Tools, right click the web site in question(probably your Default web site), and the path you're looking for will be on the Home Directory tab.

        To Theseus and Famous; you were both right about my url being off and where the root directory is located. I even set IIS to look into my web dirictory by default with the help you posted, but I still cannot get any of the product pages to come up using the cgi script. I am beginning to have my doubts that I actually have perl running on my machine. I use Indigo Perl and it is supposed to come with a preinstalled Apache webserver. When I start the program I get Apache running and no errors but I have my doubts. Thanks for your help so far and if you think of any thing else email me at wbishop@herb-pharm.com at least that way I will get back to you a lot faster. Thanks again
Re: cgi Beginner
by DamnDirtyApe (Curate) on Nov 07, 2002 at 21:06 UTC

    I don't know anything about WebShop, but getting a prototype for your web store shouldn't be too overwhelming. How much functionality does this program need to have by the 13th? If it's just a prototype to prove it can be done, you should be fine.

    Also, where does the information about your products come from? Do you have an existing database you're going to connect to, or is it all from scratch?


    _______________
    DamnDirtyApe
    Those who know that they are profound strive for clarity. Those who
    would like to seem profound to the crowd strive for obscurity.
                --Friedrich Nietzsche
      It just needs to run. All the products are in an existing database, in fact What I have is the entire website my boss setup about 4 years ago for another company. He just cannot remember how he got it working. His site was on a actual web server visable to the internet mine is only to be visable to our intranet. Would this make a Difference? Thanks For your quick response

        Thanks for the extra info. Forgive me if I'm wrong, but it sounds to me like you're a bit green at web development, or at least at CGI programming. Here's some advice that might get you going.

        The basic catalogue should generally consist of two main components: A way of determining what products the customer wants to see, and a way of getting that information from your database to the customer's screen.

        To determine what it is your customer want's to see, you'll want to read the parameters in the url. If an address such as http://www.mystore.com/catalogue.pl?category_id=201 were requested, your script catalogue.pl should use the CGI module to read the category requested, then construct a SQL query and query the database using the DBI module.

        The database will (hopefully) return some product information for you. You'll probably want to loop through this info, and display it to the user in a useful form. This should at least get you started with a functional catalogue.

        One more thing I'd suggest is that you look at using a templating system (my favourite is the Template Toolkit) to separate your application code (Perl) from your presentation code (HTML/Javascript/...). It will make your life much, much easier. :-)

        Good luck, and just ask if you have any more questions.


        _______________
        DamnDirtyApe
        Those who know that they are profound strive for clarity. Those who
        would like to seem profound to the crowd strive for obscurity.
                    --Friedrich Nietzsche
Re: cgi Beginner
by Mr. Muskrat (Canon) on Nov 07, 2002 at 20:27 UTC