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

Hi monks, I don't think this isa question to be posted in a forum like this.. but still, this is the only place I found helpful, I reuest all the monks to help this novice user out of this.... I have a perl cgi script thats not working.
print "<FORM NAME="info" action="../../../../cgi-bin/decision.cgi" met +hod="POST"> /n"; print "<select NAME="clown"> /n"; foreach $ckey(sort (keys(%DECISION))) { print "<option>$ckey /n"; } print "</select> /n"; print "</FORM> /n";
When i run it locally using the perl interpreter, it prints the "ckey". The output is
<FORM NAME="info" action="../../../../cgi-bin/clotdecisions.cgi" metho +d="POST"> <select NAME="clown"> <option>b01 <option>b02 <option>b03 </select>
So nothin wrong with getting the key values from hash. But on the webpage, the Form is empty. when i see the the page source in browser, its like
<FORM NAME="info" action="../../../../cgi-bin/clotdecisions.cgi" metho +d="POST"> <select NAME="clown"> </select>
what happened to the options. can one of you mighty monks help me out with this please. i was stuck here for a long time. I would appreciate any help extended.. thanks in advance Update1: Thanks for the suggestions monks. But none of these worked. I replaces the relative path with absolute path. Comin to the way keys in %decisions are generated, The Decisions db file already exists.
tie %CLOTDECISIONS, 'DB_File', "$fdbl[2]clotdes$typedb";
There are no errors on the server error-log regarding this. Regarding what monk. Matija asked, "how you're generating the values and keys of the %DECISION hash". I donno how they have been generated. This file was created by an other person, using DB_file. Because of version compatibility problems, i had to replace the "Dbmopen" with "tie". I donno whatelse to mention here. The file permissions, path etc are fine. Coz, as I told you the cgi script displays everything, excepting the print statements associated with Db_file. Thats what i showed in the output. the form drop-down menu wouldnt show the options. it is empty. when the script can retrieve the key locally and outputit, why not on the webpage. I can't find any obvious reason, but i'm deperate. If you need more information to sort this out, kindly ask the info you're lookin for. thanks in advance.

Replies are listed 'Best First'.
Re: script working locally, but not on server
by Tomte (Priest) on Jun 15, 2004 at 12:17 UTC

    As matija wrote, you didn't described your problem in a very good way.

    Nevertheless one advise:

    <FORM NAME="info" action="../../../../cgi-bin/clotdecisions.cgi" metho +d="POST">
    Don't use relative paths with "../" in them as actions or URLs in anchors, use relative descending paths (like myaction) or better yet absolute paths.

    Not Only do you enhance your security a wee bit, you also avoid possible confusion on how many levels upward you actualy have to go and where exactly on the file-system the location of the files is:)

    regards,
    tomte


    An intellectual is someone whose mind watches itself.
    -- Albert Camus

Re: script working locally, but not on server
by matija (Priest) on Jun 15, 2004 at 08:06 UTC
    We need to see how you're generating the values and keys of the %DECISION hash - most likely, the error is there. I find it very, very hard to believe that hashes would suddenly stop working on the server.
Re: script working locally, but not on server
by zentara (Cardinal) on Jun 15, 2004 at 12:23 UTC
    Usually when a cgi program works locally, but not on the server, its a permissions problem. However in your case (if I'm interpreting your problem correctly), is that "../../../../cgi-bin/clotdecisions.cgi" method="POST"> isn't there on your server. Try putting the "absolute path" top the cgi script, like: "http://myserver.com/cgi-bin/clotdecisions.cgi method="POST"

    Or post more information, like any error messages in your weblogs. You can also get useful debugging info by putting this in your script:

    use CGI::Carp qw(fatalsToBrower);
    Which may print the error out to your browser. (Do not run in production, use only for debugging).

    I'm not really a human, but I play one on earth. flash japh