www.webdeveloper.com
Results 1 to 4 of 4

Thread: $env{'content_length'}

  1. #1
    Join Date
    Apr 2010
    Posts
    3

    $env{'content_length'}

    I'm trying to write a forum-like simple cgi to get feedback from customers who visited my site.

    I had this code:
    Code:
    if ($request_method eq "GET") {
      $query_string = $ENV{'QUERY_STRING'};
    } elsif ($request_method eq "POST") {
       read (STDIN, $query_string, $ENV{'CONTENT_LENGTH'});
    }
    to handle both "POST" or "GET" method.

    But when it runs, "GET" works; but "POST" doesn't.

    After a while, I realised it was $ENV{'CONTENT_LENGTH'} that created the error. How come? I thought that was standard stuff?

  2. #2
    Join Date
    Apr 2010
    Posts
    3
    An update on the condition, $ENV{'CONTENT_LENGTH'} does return 75 as the value, but it doesn't compute for STDIN....

  3. #3
    Join Date
    Oct 2007
    Location
    Vienna, Austria
    Posts
    393
    Don't reinvent the wheel. Use a module, like CGI::Minimal.

  4. #4
    Join Date
    Mar 2010
    Location
    Singapore
    Posts
    367
    Hi I am not trying to convince you to change the approach but I thought CGI has always been a performance problem when load gets heavy ? I still thought Mod_Perl will be the de-facto solution for Perl web apps nowadays but it seems I'm wrong. I was still exploring Mod_Perl and HTML::Mason. Hmm... I think I need some exploration on Perl CGI modules too.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles