Apache2::Reload and Class::DBI

I had some issues with Apache2::Reload and Class::DBI not playing nice together. The problem s something about CDBI not wanting to over-write existing symbols when it reloads classes. I found a hack on some japanese Perl forum for Apache::Reload, and I ported it to Apache2. Hopefully this helps somebody.

This is the modified section of /usr/lib/perl5/Apache2/Reload.pm, version 0.09:

if ($mtime > $Stat{$file}) {
my $package = module_to_package($key);
if ( UNIVERSAL::isa($package, 'Class::DBI') ){
no strict 'refs';
warn "Apache2::Reload: clear the symbol table of $package\n" if $DEBUG;
%{"$package\::"} = ();
}
ModPerl::Util::unload_package($package);
require $key;
warn("Apache2::Reload: process $$ reloading $package from $key\n")
if $DEBUG;
}