At 2:03 PM -0500 3/21/02, Aaron Ross wrote:
>
>> I'm testing with the Perl script below, with the filename ending
>> ".mperl" (which, in my configuration, causes it to run as a mod_perl
>> registry script).
>
> I would re-write it as a handler and see if Apache::Registry is partly
>to blame.
I tried doing it as a handler, using the configuration below (and the
appropriate changes in the source) and the problem persists. So it
doesn't seem to be Registry's fault.
<Location /dan>
SetHandler perl-script
PerlHandler DanTest
</Location>
---- source code ----
#!/usr/bin/perl
package DanTest;
use strict;
use BerkeleyDB qw( DB_CREATE DB_INIT_MPOOL DB_INIT_CDB );
my $dir='/home/httpd/some/path';
sub handler {
system( "rm $dir/__db* $dir/TESTdb" );
foreach( 1..5 ) {
my $env = open_env($dir);
my %hash;
my $db = open_db( "TESTdb", \%hash, $env );
untie %hash;
undef $db;
undef $env;
}
print "HTTP/1.1 200\nContent-type: text/plain\n\n";
print `db_stat -c -h $dir`;
print "\n";
}
sub open_env {
my $env = new BerkeleyDB::Env(
-Flags=>DB_INIT_MPOOL|DB_INIT_CDB|DB_CREATE,
-Home=> $_[0],
);
die "Could not create env: $! ".$BerkeleyDB::Error. "\n" if !$env;
return $env;
}
sub open_db {
my( $file, $Rhash, $env ) = @_;
my $db_key = tie( %{$Rhash}, 'BerkeleyDB::Btree',
-Flags=>DB_CREATE,
-Filename=>$file,
-Env=>$env );
die "Can't open $file: $! ".$BerkeleyDB::Error."\n" if !$db_key;
return $db_key;
}
1;
Dan Wilga [EMAIL PROTECTED]
Web Technology Specialist http://www.mtholyoke.edu
Mount Holyoke College Tel: 413-538-3027
South Hadley, MA 01075 "Seduced by the chocolate side of the Force"