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

I have created a simple form and after clicking the submit button the arguments have to pass in perl script.This is HTML code saved with form.html

<HTML> <BODY BGCOLOR="#FFFFFF"> <H1>Basic Form </H1> <FORM ACTION=\cgi-bin\process.pl METHOD=POST> Please Enter Your Name: <INPUT TYPE=TEXT NAME="name" LENGTH=30> <P> How do you like to be evaluated? <SELECT NAME = "choice" > <OPTION SELECTED> Quizzes <OPTION> Projects <OPTION> Tests </SELECT> <P> <INPUT TYPE=SUBMIT VALUE="Submit Form"> </FORM> </BODY> </HTML>

This is the perl script saved as process.pl

#!/usr/bin/perl use CGI qw(:cgi-lib :standard); &ReadParse(%in); $name = $in{"name"}; $preference = $in{"choice"}; print<<EOSTUFF; Content-type: text/html <HTML> <BODY BGCOLOR=WHITE TEXT=BLACK> <H1> Hello, $name </H1> You prefer $preference. <BR> EOSTUFF

I have kept these files in the same directory along with web config file.While running in IIS server, After the user inputs information, the form calls another CGI program called process.pl that uses the input and generatess another web page.I'm unable to call process.pl file.

Its giving the following error..HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

I can't understand where I have done mistake.Please help me out.

Replies are listed 'Best First'.
Re: Error in IIS server for Perl script
by hippo (Archbishop) on Jul 11, 2019 at 15:43 UTC
    <FORM ACTION=\cgi-bin\process.pl METHOD=POST>

    URLs, even relative ones, do not use backslashes as path separators. Use slashes instead. Also, attributes in HTML should have their values quoted.

    <FORM ACTION="/cgi-bin/process.pl" METHOD="POST">

    PS. Given the way it currently looks I strongly recommend that you run your HTML through a validator such as HTML::Valid.

      > Also, attributes in HTML should have their values quoted.

      That is not always needed (in XML, they have, but it's a different story). See e.g. Unquoted attribute values.

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

        Yes, it's definitely "should" and not "must". Similarly to use strict; in Perl. In both cases, doing that will cause you no harm. You are free not to do that but if (when!) things break, you get to keep both halves.

Re: Error in IIS server for Perl script
by haukex (Archbishop) on Jul 11, 2019 at 15:54 UTC

    It appears you're working from some really, really old code examples: no warnings, no strict, cgi-lib, calling functions with &, writing old-style HTML by hand, ... I would strongly recommend using a newer codebase / tutorial! See e.g. UP-TO-DATE Comparison of CGI Alternatives.

Re: Error in IIS server for Perl script ( no ReadParse no CGI->Vars they corrupt data )
by Anonymous Monk on Jul 13, 2019 at 02:12 UTC