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

Dear Monks,

I am very stuck writing a perl cgi. The problem is that when the form is submitted (using POST) the error 'Method not allowed: the requested method post is not allowed for the url'.
I checked the permissions, the url's, and changed the file extensions to .cgi. I then changed 'POST' to 'GET' and when the form was submitted the .cgi script appears on the screen! Has anyone had this problem before? Any suggestions?

Thanks :)

update (broquaint): changed title and added formatting

  • Comment on puzzling problem with POST and perl CGI (was: perl cgi)

Replies are listed 'Best First'.
Re: perl cgi
by rdfield (Priest) on Nov 06, 2002 at 11:28 UTC
    It looks like you're trying to run before you can walk. Please read the CGI tutorials in the Tutorials section for lots of useful information. You have to have the server set up correctly (e.g. the correct file associations) before the CGI magic can happen.

    rdfield

Re: (nrd) perl cgi
by newrisedesigns (Curate) on Nov 06, 2002 at 14:14 UTC

    You'll need to configure something more on your server to allow your CGI files to recieve POST queries. There should be an area in your Apache (assuming that's what you're using) configuration file that allows for changing the settings you require.

    If you need any more help, why don't you post a follow-up? After signing up for Perl Monks, of course. Good luck.

    John J Reiser
    newrisedesigns.com

Re: perl cgi
by Callum (Chaplain) on Nov 06, 2002 at 14:26 UTC
    Your web server needs to know that the file you're POSTing to is a cgi file, check the cgi-script handler (in srm.conf?)

    eg: AddHandler cgi-script .cgi

Re: puzzling problem with POST and perl CGI (was: perl cgi)
by Anonymous Monk on Nov 06, 2002 at 19:51 UTC
    Sounds like this is a IIS server. If i remember i ran into this once too with an old version of IIS. As it turned out It didnt support the POST method. I'de look at your server, or just run this as a get, if you dont want the whole ?var=xx at the end of the url, just put the thing in a frame and do a redirect.
    Digital G