in reply to Detecting a post via cgi

There are some methods to do this:
1) check $ENV{REQUEST_METHOD}:
if($ENV{'REQUEST_METHOD'} eq 'GET') { $query=$ENV{'QUERY_STRING'} } elsif($ENV{'REQUEST_METHOD'} eq 'POST') { sysread STDIN,$query,$ENV{' +CONTENT_LENGTH'} } else { print 'Unsupport method: '.$ENV{'REQUEST_METHOD'}.'!!!'; }
2) use module CGI:
use CGI; my $q = CGI->new(); if(defined $q->param('submit')) { my $user = $q->param('user_name'); my $pass = $q->param('user_password'); } else { print "Content-type: text/html\n\n"; print <<END; <table> <form method='POST'> <tr><td>User name:</td><td><input type='text' name='user_name' +></td></tr> <tr><td>Password:</td><td><input type='password' name='user_pa +ssword'></td></tr> <tr><td colspan=2><input type='submit' name='submit' value=' L +ogin '></td></tr> </form> </table> END }
3) Embperl keeps all passed data into hash %fdat, and it doesn't matter what method is used in your form.
4) Mason keeps all passed data into hash %ARGS or you can define needed data in the block of code <%ARGS></%ARGS> and it doesn't matter what method is used in your form.
If you develop small script, in my mind, it's better to use CGI.pm or manual processing of form data. But if you develop site or huge web application it's better to embed Perl using Embperl, Mason or another tool. Because it makes easier developer's life appreciably.
      
--------------------------------
SV* sv_bless(SV* sv, HV* stash);