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

Can I get at the parameters in my CGI program using the CGI.pm module if I am progamming an asp page run against MS IIS? The following code produces no output, I am posting a whole load of fields from a form to my asp page and was expecting this to pick up 'em up,
use CGI; sub do_work { my($query) = @_; my(@values,$key); print "<H2>Here are the current settings in this form</H2>"; foreach $key ($query->param) { print "<STRONG>$key</STRONG> -> "; @values = $query->param($key); print join(", ",@values),"<BR>\n"; } } my $query = new CGI; do_work($query);
If I use the $Request object, i.e something like ,
my($form_item) = $Request->item($field_name); $form_item = $Server->HTMLEncode($form_item);
then I get back what I'm after, but I'd prefer to use the CGI.pm module as I've seen some examples where you can easily pull the fields back into a hash table and I'd like to use it. Wired Active Perl 5.6 into IIS. Another problem is that I have to replace the print statement with a $Response->Write(...) method call. Do I have to do something to STDOUT to get print to work properly (I suspect its output is going off into the void somewhere) in an asp page?

Replies are listed 'Best First'.
Re: Form parameters in CGI
by fruiture (Curate) on Oct 12, 2002 at 16:10 UTC

    Well, CGI is CGI and ASP is ASP. It's not likely that you can usea CGI module for ASP applications...

    At least i have an idea how you could solve the Write() and print() problem: Create an IO::Handle that points to a scalar (use IO::Scalar if you don't have 5.8.0) and then select() this handle. In the end you can Write() the whole thing at once...

    --
    http://fruiture.de