ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perlex
perlex
Help with CGI.PM and Perlex
by Tom Bozarth other posts by this author
Sep 15 2006 11:07AM messages near this date
PerlEx not tracing | [Fwd: Serious problems using Oracle 10g 10.2.0 Client with DBD-Oracle module loaded on Windows!]
SERVICES Hello,

I am running into a problem with a very basic function with CGI.PM. The code will not param 
correctly.

This first test code taken from the POD will not param any values. If I modify the code usin
g the suggestion from the Perlex FAQ, it param correctly ON the first invocation. The subseq
uent post will not param any values. If I restart IIS then the first invocation will param c
orrectly and subsequent post will not param any values as above. I am running XP Pro SP2.

Thanks in advance for your help/advice.


CODE BELOW PARAM DOES NOT WORK AT ALL

  # CGI script that creates a fill-out form
  # and echoes back its values.

  use CGI qw/:standard/;
  print header,
        start_html('A Simple Example'),
        h1('A Simple Example'),
        start_form,
        "What's your name? ",textfield('name'),p,
        "What's the combination?", p,
        checkbox_group(-name=> 'words',
                       -values=> ['eenie','meenie','minie','moe'],
                       -defaults=> ['eenie','minie']), p,
        "What's your favorite color? ",
        popup_menu(-name=> 'color',
                   -values=> ['red','green','blue','chartreuse']),p,
        submit,
        end_form,
        hr;

   if (param()) {
       my $name      = param('name');
       my $keywords  = join ', ',param('words');
       my $color     = param('color');
       print "Your name is",em(escapeHTML($name)),p,
             "The keywords are: ",em(escapeHTML($keywords)),p,
             "Your favorite color is ",em(escapeHTML($color)),
             hr;
   }

CODE BELOW PARAM WORKS ON FIRST POST ONLY

use CGI qw/:standard/;
my $q = CGI::-> new();
  
print header,
        start_html('A Simple Example'),
        h1('A Simple Example'),
        start_form,
        "What's your name? ",textfield('name'),p,
        "What's the combination?", p,
        checkbox_group(-name=> 'words',
                       -values=> ['eenie','meenie','minie','moe'],
                       -defaults=> ['eenie','minie']), p,
        "What's your favorite color? ",
        popup_menu(-name=> 'color',
                   -values=> ['red','green','blue','chartreuse']),p,
        submit,
        end_form,
        hr;

if ($q-> param('name')) {
       my $name      = $q-> param('name');
       my $keywords  = join ', ',$q-> param('words');
       my $color     = $q-> param('color');
       print "Your name is",em(escapeHTML($name)),p,
             "The keywords are: ",em(escapeHTML($keywords)),p,
             "Your favorite color is ",em(escapeHTML($color)),
             hr;
}

CGI::initialize_globals();

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved