Skip Menu |

This queue is for tickets about the Maypole CPAN distribution.

Report information
The Basics
Id: 14120
Status: resolved
Priority: 0/
Queue: Maypole

People
Owner: TEEJAY [...] cpan.org
Requestors: dave [...] riverside-cms.co.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.10
Fixed in: 2.11



Subject: inheritance broken in Maypole::Application
Hi Aaron, I've finally upgraded to 2.10. In Maypole::Application, plugins are pushed onto @plugin_modules, which is then pushed onto the caller's @ISA, and then $class (Maypole::Application) is pushed onto the caller's @ISA. Meanwhile, plugins are also unshifted onto Maypole::Application::ISA. So in an app I have that loads a bunch of plugins, I end up with this: package LTSIFB; use Maypole::Application qw( LTSIFB Config::Apache ColumnGroups MasonX FormBuilder Relationship LinkTools QuickTable Session -Debug -Setup ); LTSIFB ISA: Maypole::Plugin::LTSIFB Maypole::Plugin::Config::Apache Maypole::Plugin::ColumnGroups Maypole::Plugin::FormBuilder Maypole::Plugin::Relationship Maypole::Plugin::LinkTools Maypole::Plugin::QuickTable Maypole::Plugin::Session Maypole::Application Maypole::Application ISA: Maypole::Plugin::Session Maypole::Plugin::QuickTable Maypole::Plugin::LinkTools Maypole::Plugin::Relationship Maypole::Plugin::FormBuilder Maypole::Plugin::ColumnGroups Maypole::Plugin::Config::Apache Maypole::Plugin::LTSIFB MasonX::Maypole which causes bugs, especially when I'm loading multiple apps in the same mod_perl server. Here's a patch that fixes it: dave@evesham$ diff -u Application.pm-2.10 Application.pm-PATCHED --- Application.pm-2.10 Tue Jul 5 19:05:12 2005 +++ Application.pm-PATCHED Thu Aug 11 22:28:58 2005 @@ -26,7 +26,9 @@ $frontend ||= 'CGI::Maypole'; $frontend->require or die "Loading $frontend frontend failed: $@"; - push @ISA, $frontend; + + # inheritance may already be set up in a multi-app mod_perl environment + push @ISA, $frontend unless __PACKAGE__->isa( $frontend ); my $autosetup=0; my @plugin_modules; @@ -44,7 +46,6 @@ my $plugin = "Maypole::Plugin::$_"; if ($plugin->require) { push @plugin_modules, "Maypole::Plugin::$_"; - unshift @ISA, "Maypole::Plugin::$_"; warn "Loaded plugin: $plugin for $caller" if $caller->can('debug') && $caller->debug; } else {
From: dave [...] riverside-cms.co.uk
Or an alternate patch, addressing the other inheritance issue as well. I think this is preferable, it takes MP::App out of the chain altogether, and allows different apps in the same server to have different frontends. dave@evesham$ diff -u Application.pm-2.10 Application.pm-PATCHED --- Application.pm-2.10 Tue Jul 5 19:05:12 2005 +++ Application.pm-PATCHED Thu Aug 11 23:24:10 2005 @@ -26,8 +26,7 @@ $frontend ||= 'CGI::Maypole'; $frontend->require or die "Loading $frontend frontend failed: $@"; - push @ISA, $frontend; my $autosetup=0; my @plugin_modules; { @@ -44,7 +43,6 @@ my $plugin = "Maypole::Plugin::$_"; if ($plugin->require) { push @plugin_modules, "Maypole::Plugin::$_"; - unshift @ISA, "Maypole::Plugin::$_"; warn "Loaded plugin: $plugin for $caller" if $caller->can('debug') && $caller->debug; } else {
[DAVEBAIRD - Thu Aug 11 18:31:02 2005]: Show quoted text
> Or an alternate patch, addressing the other inheritance issue as well. I > think this is preferable, it takes MP::App out of the chain altogether, > and allows different apps in the same server to have different frontends. > > dave@evesham$ diff -u Application.pm-2.10 Application.pm-PATCHED > --- Application.pm-2.10 Tue Jul 5 19:05:12 2005 > +++ Application.pm-PATCHED Thu Aug 11 23:24:10 2005 > @@ -26,8 +26,7 @@ > $frontend ||= 'CGI::Maypole'; > > $frontend->require or die "Loading $frontend frontend failed: $@"; > - push @ISA, $frontend; > > my $autosetup=0; > my @plugin_modules; > { > @@ -44,7 +43,6 @@ > my $plugin = "Maypole::Plugin::$_"; > if ($plugin->require) { > push @plugin_modules, "Maypole::Plugin::$_"; > - unshift @ISA, "Maypole::Plugin::$_"; > warn "Loaded plugin: $plugin for $caller" > if $caller->can('debug') && $caller->debug; > } else {
The alternate patch looks the same, anyway the patch has been applied to SVN, revision 372.
[TEEJAY - Fri Aug 19 07:51:26 2005]: Show quoted text
> [DAVEBAIRD - Thu Aug 11 18:31:02 2005]: >
> > Or an alternate patch, addressing the other inheritance issue as
> well. I
> > think this is preferable, it takes MP::App out of the chain
> altogether,
> > and allows different apps in the same server to have different
> frontends.
> > > > dave@evesham$ diff -u Application.pm-2.10 Application.pm-PATCHED > > --- Application.pm-2.10 Tue Jul 5 19:05:12 2005 > > +++ Application.pm-PATCHED Thu Aug 11 23:24:10 2005 > > @@ -26,8 +26,7 @@ > > $frontend ||= 'CGI::Maypole'; > > > > $frontend->require or die "Loading $frontend frontend failed:
> $@";
> > - push @ISA, $frontend; > > > > my $autosetup=0; > > my @plugin_modules; > > { > > @@ -44,7 +43,6 @@ > > my $plugin = "Maypole::Plugin::$_"; > > if ($plugin->require) { > > push @plugin_modules, "Maypole::Plugin::$_"; > > - unshift @ISA, "Maypole::Plugin::$_"; > > warn "Loaded plugin: $plugin for $caller" > > if $caller->can('debug') && $caller->debug; > > } else {
> > > The alternate patch looks the same, anyway the patch has been applied > to > SVN, revision 372.
Sorry, these patches were incomplete (chopped off the bottom). Full patch applied in revision 376. d.