Hi
I have the simplest test case of a mod perl module which is
using Rec::Descent module to parse some string. I can run
the script on command line so there is no problem with the
script but when run via web server as a mod_perl module, I
get an error in the error_log :
[Tue Jun 11 14:25:27 2002] [error] Unknown starting rule
(Parse::RecDescent::0::Replace) called
at /home/praveen/temp/mod_perl_expr.pm line 9
The web server is running as 'praveen' - the same user
which can also run the script from command line to test
out 'mod_perl_expr.pm' module.
The relevant portion in httpd.conf :
<Location /mod_perl_expr>
SetHandler perl-script
PerlHandler mod_perl_expr
</Location>
The mod_perl module is given :
package mod_perl_expr;
use strict;
use Parse::RecDescent;
sub handler
{
my $r=shift;
my $p=Parse::RecDescent->new(grammar());
my $result = 0;
eval { $result = $p->expr("3+4") };
$r->send_http_header;
print<<EOJ;
<html><body><H3>RESULT -> $result</h3></body></html>
EOJ
}
sub grammar
{
return<<'GRAMMAR';
expr : number '+' number
{$return=$item[1]+$item[3]; }
number : /\d+/
GRAMMAR
}
1;
=====
- Praveen
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com