Hi,

   I'm running Apache on a MacOS X (10.1.2) box in IP-loopback mode, and 
I'm experiementing with a CGI script that acts like a state-machine.  I 
cooked up the example at the bottom of the page.  If I run it as is, it 
runs fine.  But if I comment out line 48, which tells &action1 to exit 
when it finishes, the browser displays this message, after which it 
executes &action2 (correctly):

t2.pl: Argument "action2" isn't numeric in numeric eq (==) at <file 
path> line 16.

   What does this mean, and why does it only show up if the exit() 
statment is commented?  If I run it at the command line, it runs fine, 
exept it tells me that &action1 and &action2 are called too early to 
check their prototypes (which I expected). If I change the quotes in 
lines 14 and 16 to double-quotes, it sill exibits the same behavior.

Thanks,
Jim Witte
[EMAIL PROTECTED]


#!/usr/bin/perl
use CGI qw(:standard);
use diagnostics;
use CGI::Carp qw(fatalsToBrowser);
BEGIN {
  use CGI::Carp qw(carpout);
  carpout(STDOUT);
}
$commname = param('commname');
if (!$commname) {
        dostart(); }
if ($commname == 'action1')  {
        action1(); }
if ($commname == 'action2') {  #### line 16
        action2(); }

sub dostart()
{
        print header;
        print start_html('A Simple Example'),
                h1('A Simple Example'),
                start_form,
                "What's your name [dostart]? ",textfield('name'),
                submit('commname', 'action1'),
                end_form,
                end_html;
        exit();
}

sub action1()
{
        print header,
                start_html('Action 1 completion'),
                "[action1] Your name is ", em(param('name')),
                p,
                end_html;
        exit();  #### line 48 ####
}

sub action2()
{
        print header,
                start_html('Action 2 completion'),
                "[action2] Your name is ", em(param('name')),
                p,
                end_html;
}

Reply via email to