From: David Baird Date: Sat, 20 Aug 2005 14:03:31 +0000 (+0000) Subject: tidied up inheritance in Mp::App - bugs 12923 & 14120 X-Git-Tag: 2.11~141 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=362c7a1f666b6900c4cfa3524db3ce0449927989;p=maypole.git tidied up inheritance in Mp::App - bugs 12923 & 14120 git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@377 48953598-375a-da11-a14b-00016c27c3ee --- diff --git a/Changes b/Changes index dbf4c9b..8b6fa1d 100644 --- a/Changes +++ b/Changes @@ -12,6 +12,8 @@ For information about current developments and future releases, see: Maypole::Session::generate_unique_id() now returns the id (bug 14124) Implement -Init flag in Mp::Application (wishlist 14123) add() alias to push() in Mp::Headers (wishlist 14142) + Fixed inheritance issues in Mp::Application - Mp::App now manipulates the caller's + @ISA directly, and doesn't inject itself into the chain (bugs 12923 & 14120) 2.10 Tue 19 Jul 2005 Multiple Template Paths added ( http://rt.cpan.org/NoAuth/Bug.html?id=13447 ) diff --git a/lib/Maypole/Application.pm b/lib/Maypole/Application.pm index a0e49bc..60542f9 100644 --- a/lib/Maypole/Application.pm +++ b/lib/Maypole/Application.pm @@ -6,11 +6,11 @@ use UNIVERSAL::require; use Maypole; use Maypole::Config; -our @ISA; our $VERSION = '2.11'; sub import { - my ( $class, @plugins ) = @_; + shift; # not interested in this - we manipulate the caller's @ISA directly + my @plugins = @_; my $caller = caller(0); my $frontend = 'Apache::MVC' if $ENV{MOD_PERL}; @@ -26,8 +26,6 @@ sub import { $frontend ||= 'CGI::Maypole'; $frontend->require or die "Loading $frontend frontend failed: $@"; - # inheritance may already be set up in a multi-app mod_perl environment - push @ISA, $frontend unless __PACKAGE__->isa( $frontend ); my $autosetup=0; my $autoinit=0; @@ -57,7 +55,7 @@ sub import { } } no strict 'refs'; - push @{"${caller}::ISA"}, @plugin_modules, $class; + push @{"${caller}::ISA"}, @plugin_modules, $frontend; $caller->config(Maypole::Config->new); $caller->config->masonx({}) if $masonx; $caller->setup() if $autosetup; diff --git a/lib/Maypole/Model/CDBI/Plain.pm b/lib/Maypole/Model/CDBI/Plain.pm index 9cce688..7833c7b 100644 --- a/lib/Maypole/Model/CDBI/Plain.pm +++ b/lib/Maypole/Model/CDBI/Plain.pm @@ -26,7 +26,7 @@ Maypole::Model::CDBI::Plain - Class::DBI model without ::Loader =head1 SYNOPSIS package Foo; - use base 'Maypole::Application'; + use 'Maypole::Application'; use Foo::SomeTable; use Foo::Other::Table;