stas 2002/12/29 01:18:50
Modified: ModPerl-Registry/lib/ModPerl RegistryLoader.pm
ModPerl-Registry/t/conf modperl_extra_startup.pl
Log:
make ModPerl::RegistryLoader work like 1.0 version does, namely restore
the new() functionality
Revision Changes Path
1.6 +9 -5 modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryLoader.pm
Index: RegistryLoader.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryLoader.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- RegistryLoader.pm 28 Dec 2002 07:39:20 -0000 1.5
+++ RegistryLoader.pm 29 Dec 2002 09:18:50 -0000 1.6
@@ -11,9 +11,7 @@
our @ISA = ();
-# using create() instead of new() since the latter is inherited from
-# the SUPER class, and it's used inside handler() from the SUPER class
-sub create {
+sub new {
my $class = shift;
my $self = bless {@_} => ref($class)||$class;
$self->{package} ||= 'ModPerl::Registry';
@@ -48,7 +46,8 @@
$self->warn("Cannot find a translated from uri: $filename");
return;
}
- } else {
+ }
+ else {
# try to guess
(my $guess = $uri) =~ s|^/||;
@@ -74,7 +73,12 @@
package => $self->{package},
} => ref($self) || $self;
- __PACKAGE__->SUPER::handler($rl);
+ # can't call SUPER::handler here, because it usually calls new()
+ # and then the ModPerlRegistryLoader::new() will get called,
+ # instead of the super class' new, so we implement the super
+ # class' handler here. Hopefully all other subclasses use the same
+ # handler.
+ __PACKAGE__->SUPER::new($rl)->default_handler();
}
1.5 +2 -2 modperl-2.0/ModPerl-Registry/t/conf/modperl_extra_startup.pl
Index: modperl_extra_startup.pl
===================================================================
RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/t/conf/modperl_extra_startup.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- modperl_extra_startup.pl 16 Aug 2002 09:01:17 -0000 1.4
+++ modperl_extra_startup.pl 29 Dec 2002 09:18:50 -0000 1.5
@@ -12,7 +12,7 @@
# test the scripts pre-loading by explicitly specifying uri => filename
-my $rl = ModPerl::RegistryLoader->create(package => "ModPerl::Registry");
+my $rl = ModPerl::RegistryLoader->new(package => "ModPerl::Registry");
my $base_uri = "/cgi-bin";
for my $file (qw(basic.pl env.pl)) {
my $file_path = "$base_dir/$file";
@@ -29,7 +29,7 @@
return Apache::server_root_relative($pool, $uri);
}
- my $rl = ModPerl::RegistryLoader->create(
+ my $rl = ModPerl::RegistryLoader->new(
package => "ModPerl::RegistryBB",
trans => \&trans,
);