We had recompiled ePerl for 5.8.0 and mod_perl (1.27 and later 1.28)
statically linked with Apache with default options (does it include
threads?)
I'm using only Apache::ePerl which allows me use Perl in the the way
like
PHP, since I don't need Mason or EmbPerl html features for small WAP
resources.
It just does simple things parse & eval perl code saving it in global
$Cache hash. It use C code only for parsing eperl scripts
sourse. Switching off $Cache (adding if (1 || ..)) -- always compiling,
eliminate the
Cache bug. Something just mix key & value pairs in global hash shared by
httpd process,
after several requests. I just can't understand where the Apache::ePerl
bug can be --
it so simple and so clear module.. and it worked on older perl!
I will keep debuging,
-vlad
where is all community? it's so silent in the conference. what the
language
perl programmers migrated to? JSP, PHP? :(
=======
package Apache::ePerlWAP;
# requirements and runtime behaviour
require 5.00325;
use strict;
use vars qw($VERSION);
use vars qw($nDone $nOk $nFail $Cache $Config);
# imports
use Carp;
use Apache ();
use Apache::Debug;
use Apache::Constants qw(:common OPT_EXECCGI);
use FileHandle ();
use File::Basename qw(dirname);
use Parse::ePerl;
use lib '/usr/home/projects/lib';
use IMMO::Translit qw(:all); # to translit or utf8
# private version number
$VERSION = do { my @v=("2.2.14"=~/\d+/g); sprintf "%d."."%02d"x$#v,@v };
# globals
$nDone = 0;
$nOk = 0;
$nFail = 0;
$Cache = {};
...
#
# the mod_perl handler
#
sub handler {
my ($r) = @_;
my ($filename, $data, $error, $fh);
my (%env, $rc, $mtime, $owner, $size, $header, $key, $value, $path,
$xpath, $dir, $file, @S);
# statistic
$nDone++;
...
# check cache for existing P-code
# ! added 1 ||
if (not ( $Cache->{$filename}
and $Cache->{$filename}->{CODE}
and $Cache->{$filename}->{SIZE} == $size
and $Cache->{$filename}->{MTIME} == $mtime
and $Cache->{$filename}->{OWNER} eq $owner)) {
# read script
local ($/) = undef;
$fh = new FileHandle $filename;
$data = <$fh>;
$fh->close;
# run the preprocessor over the script
if (not Parse::ePerl::Preprocess({
Script => $data,
Cwd => dirname($filename),
Result => \$data
})) {
&send_errorpage($r, 'Error on preprocessing script', '');
$nFail++;
return OK;
}
# translate the script from bristled
# ePerl format to plain Perl format
if (not Parse::ePerl::Translate({
Script => $data,
BeginDelimiter => $Config->{'BeginDelimiter'},
EndDelimiter => $Config->{'EndDelimiter'},
CaseDelimiters => $Config->{'CaseDelimiters'},
ConvertEntities => $Config->{'ConvertEntities'},
Result => \$data
})) {
&send_errorpage($r, 'Error on translating script from
bristled to plain format', '');
$nFail++;
return OK;
}
# precompile the source into P-code
$error = '';
if (not Parse::ePerl::Precompile({
Script => $data,
Name => $filename,
Cwd => dirname($filename),
Result => \$data,
Error => \$error
})) {
&send_errorpage($r, 'Error on precompiling script from plain
format to P-code', $error);
$nFail++;
return OK;
}
# set the new results
$Cache->{$filename} = {};
$Cache->{$filename}->{CODE} = $data;
$Cache->{$filename}->{SIZE} = $size;
$Cache->{$filename}->{MTIME} = $mtime;
$Cache->{$filename}->{OWNER} = $owner;
}
# retrieve precompiled script from cache
$data = $Cache->{$filename}->{CODE};
# evaluate script
if (not Parse::ePerl::Evaluate({
Script => $data,
Name => $filename,
Cwd => dirname($filename),
ENV => \%env,
Result => \$data,
Error => \$error
})) {
&send_errorpage($r, 'Error on evaluating script from P-code',
$error);
$nFail++;
return OK;
}
> -----Original Message-----
> From: Perrin Harkins [mailto:[EMAIL PROTECTED]
> Sent: Saturday, July 19, 2003 12:05 AM
> To: Влад Сафронов
> Cc: [EMAIL PROTECTED]
> Subject: Re: Need help, Global Hash corruption under mod_perl
> in perl 5.8.0!?!
>
>
> On Fri, 2003-07-18 at 09:03, Влад Сафронов wrote:
> > I used Apache::ePerl ( http://www.ossp.org/pkg/tool/eperl/
> > <http://www.ossp.org/pkg/tool/eperl/> ) for a long time (up to perl
> > 5.6.1)
> > until our admin install perl 5.8.0 and recompiled apache
> and mod_perl
> > with it.
> >
> > After that global hash $Cache where all precompiled eperl
> scripts kept
> > in becomes corrupted
> > (even under httpd -X) after several calls
>
> Sounds like a bug in Apache::ePerl.
>
> I'm afraid you'll find that ePerl isn't really being
> supported by anyone
> at this point. The last release was something like 5 years ago. I'd
> suggest that you consider moving your code to one of the other
> templating systems available. Meanwhile, you can try to debug
> Apache::ePerl with the usual methods.
>
> Your admin did recompile ePerl with the new version of perl as well,
> didn't he? And you are running mod_perl 1.x without threads?
>
> - Perrin
>
>