In my never ending search for more elegant looking and self-documenting code I decided to try out the Switch module. In the following fragment of code:

#!/usr/local/bin/perl

# AppSys: Manage Profile

use strict;
use CGI qw/:standard/;
use CGI::Carp qw(fatalsToBrowser);
use Switch;

my $cgi = CGI->new;

my $control = 'Search';
switch ( $control ) {
    case ("Search") {
        print $cgi->header;
        print $cgi->start_html;
        print $cgi->p("Search");
        print $cgi->end_html;
         }
}

produces the following in the Apache error log:

[error] syntax error at /home/appsys/www/modperl/ap03.pl line 12, near ") {"
syntax error at /home/appsys/www/modperl/ap03.pl line 14, near "}
}"

When run as an Apache::Registry script.

When run under mod_cgi (i.e. run from the cgi-bin directory on the same server, it works perfectly and prints 'Search' on the browser.

Server is: RH8.0, Apache 1.3.28, mod_perl 1.28, Perl 5.8.1

John

Reply via email to