--- David Romero <[EMAIL PROTECTED]> wrote:
> Victor wrote:
> > When I transmit the variables using the post method it I receive a 
> > empty string(($cgi->param(<variable>) is empty).
> >
> The POST data can be read one time, if you create an cgi objet before
> these, the second object recibe empty data.
> Is posible than one of your use modules read the post data frist.
> 
> Im fix the problem with the standatd pragma.
> 
> use CGI qw/standad/;
> my $value = param("post_var");

It is true that you can only read the POST data once (without extreme
trickery, that is), but the fix would not be to use /:standard/. 
Instead, if more than once instance of a CGI object is being
instantiated, the fix is to either remove the extraneous instantiations
or to call param() on the first instantiation which does have the POST
data.

As a more extreme method of debugging (just to verify that you're
sending the data the way you thought you were), you can always test to
ensure that you really *are* sending data via the POST method by
pointing your form to this script (typed on the fly so sorry if there
are typos):

  #!/usr/bin/perl -wT
  use strict;

  print "Content-type: text/plain\n\n";

  if ( "GET" eq $ENV{REQUEST_METHOD} ) {
    print "Request method was GET.\n";
    print $ENV{QUERY_STRING};
  }
  elsif ( "POST" eq $ENV{REQUEST_METHOD} ) {
    print "Request method was POST.\n";
    print "Content length was $ENV{CONTENT_LENGTH}\n";
    my $buffer;
    if (read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'})) {
      print $buffer;
    }
    else {
      print "Could not read STDIN";
    }
  }
  else {
    print "Don't know how to handle '$ENV{REQUEST_METHOD'";
  }

I have more information about this at Lesson 2
(http://users.easystreet.com/ovid/cgi_course/lessons/lesson_two.html)
of my course.

Cheers,
Ovid

=====
If this message is a response to a question on a mailing list, please send
follow up questions to the list.

Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to