John Day wrote:
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.
Switch uses source filters, which probably doesn't work well with the way Registry wraps scripts up into handler() subs.
without getting too far into Filter::Util::Call, Switch.pm, or Text::Balanced there is probably not much we can do to help.
you might be able to reduce the problem with a test case outside of mod_perl and pass it on to the appropriate people if it doesn't work. Registry essentially does this
package Apache::ROOT::modperl::ap03_2epl;
sub handler {
# your script } 1;
then calls Apache::ROOT::modperl::ap03_2epl::handler().
HTH
--Geoff