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.
Indeed. I've tried and failed to get source code filters working under Apache::Registry in the past, and I tried it again only recently with the same result -- it doesn't work.
However, it does work fine if you write mod_perl handler()'s yourself.
- Steve