Discussion:
Maypole::Application adds plugin classes to caller's @ISA
Matt Adams
2005-02-01 18:05:50 UTC
Permalink
Hi there:

I recently upgraded to Maypole 2.08 and discovered that it is not compatible
with the Maypole app I have been using. I'm hoping that those of you who are
more familiar with the Maypole-innards will be able to shed some light on why
I'm having the problems I am.

In the `Changes' file for Maypole 2.08 a fix is listed from Marcus Ramberg where
"Maypole::Application adds plugin classes to caller's @ISA." The effect of this
patch appears to be:

--- Application.pm (my older copy)
+++ Application.pm (Maypole SVN revision 334)
@@ -7,7 +7,7 @@
use Maypole::Config;

our @ISA;
-our $VERSION = '2.07';
+our $VERSION = '2.08';

sub import {
my ( $self, @plugins ) = @_;
@@ -28,7 +28,7 @@
if ($@) { warn qq(Loading plugin "Maypole::Plugin::$_" failed: $@) }
else {
warn "Loaded plugin: Maypole::Plugin::$_" if $caller->debug;
- unshift @ISA, "Maypole::Plugin::$_";
+ push @{"${caller}::ISA"}, "Maypole::Plugin::$_";
}
}
}

Now this is all fine and dandy but when I apply this patch my application breaks
with the following error:

MyApp...Debugging enabled
MyApp...Loaded plugin: Maypole::Plugin::Authentication::Abstract
MyApp...Loaded plugin: Maypole::Plugin::Config::YAML
MyApp...No DSN set in config
[error] Can't locate object method "new" via package "Class::DBI::Loader::"
(perhaps you forgot to load "Class::DBI::Loader::"?) at
/.../lib/Class/DBI/Loader.pm line 77.
BEGIN failed--compilation aborted at /.../MyApp.pm line 36.
Compilation failed in require at (eval 10) line 3.
[error] Can't call method "_table2class" on an undefined value at
/.../lib/Maypole/Model/CDBI.pm line 250.

It may help to know that I begin the Maypole app by writing:

BEGIN {
package MyApp;
use MyApp::Constants;
$ENV{MAYPOLE_CONFIG} = BINPATH . '/MyApp.yaml';
}

package MyApp;

use Maypole::Application qw(
-Debug
Config::YAML
Authentication::Abstract
-Setup
);

And that I am using Maypole::Plugin::Config::YAML 0.04 and
Maypole::Plugin::Authentication::Abstract 0.10.

Any explanations as to why this patch to Application.pm was made would be
greatly appreciated as would be any suggestions concerning how I might go about
fixing my application!


Thanks

Matt
--
Matt Adams <***@morcor.com>
Development Specialist
Morcor Solutions Inc. <http://www.morcor.com/>
(613) 354-2912 x228

GnuPG public key at <http://staff.morcor.com/~madams/>
Key fingerprint: BED5 B4F7 CCF5 D7B5 7C56 0505 9A0A A0FB C937 5975
Marcus Ramberg
2005-02-01 18:26:47 UTC
Permalink
Hey Matt.
I'm not about to be blamed for this ;-) Simon changed my patch, which
actually made a proxy class for you application to inherit from, and he
borked it up. He's fixed it in 2.09, which is available from CPAN.
Marcus
Post by Matt Adams
I recently upgraded to Maypole 2.08 and discovered that it is not
compatible with the Maypole app I have been using. I'm hoping that
those of you who are more familiar with the Maypole-innards will be
able to shed some light on why I'm having the problems I am.
In the `Changes' file for Maypole 2.08 a fix is listed from Marcus
Ramberg where "Maypole::Application adds plugin classes to caller's
--- Application.pm (my older copy)
+++ Application.pm (Maypole SVN revision 334)
@@ -7,7 +7,7 @@
use Maypole::Config;
-our $VERSION = '2.07';
+our $VERSION = '2.08';
sub import {
@@ -28,7 +28,7 @@
else {
warn "Loaded plugin: Maypole::Plugin::$_" if
$caller->debug;
}
}
}
Now this is all fine and dandy but when I apply this patch my
MyApp...Debugging enabled
MyApp...Loaded plugin: Maypole::Plugin::Authentication::Abstract
MyApp...Loaded plugin: Maypole::Plugin::Config::YAML
MyApp...No DSN set in config
[error] Can't locate object method "new" via package
"Class::DBI::Loader::" (perhaps you forgot to load
"Class::DBI::Loader::"?) at /.../lib/Class/DBI/Loader.pm line 77.
BEGIN failed--compilation aborted at /.../MyApp.pm line 36.
Compilation failed in require at (eval 10) line 3.
[error] Can't call method "_table2class" on an undefined value at
/.../lib/Maypole/Model/CDBI.pm line 250.
BEGIN {
package MyApp;
use MyApp::Constants;
$ENV{MAYPOLE_CONFIG} = BINPATH . '/MyApp.yaml';
}
package MyApp;
use Maypole::Application qw(
-Debug
Config::YAML
Authentication::Abstract
-Setup
);
And that I am using Maypole::Plugin::Config::YAML 0.04 and
Maypole::Plugin::Authentication::Abstract 0.10.
Any explanations as to why this patch to Application.pm was made would
be greatly appreciated as would be any suggestions concerning how I
might go about fixing my application!
Thanks
Matt
--
Development Specialist
Morcor Solutions Inc. <http://www.morcor.com/>
(613) 354-2912 x228
GnuPG public key at <http://staff.morcor.com/~madams/>
Key fingerprint: BED5 B4F7 CCF5 D7B5 7C56 0505 9A0A A0FB C937 5975
_______________________________________________
maypole mailing list
http://lists.netthink.co.uk/listinfo/maypole
Matt Adams
2005-02-01 18:32:08 UTC
Permalink
Hi Marcus:

Thanks for the heads-up. I check out 2.09!


Matt
--
Matt Adams <***@morcor.com>
Development Specialist
Morcor Solutions Inc. <http://www.morcor.com/>
(613) 354-2912 x228

GnuPG public key at <http://staff.morcor.com/~madams/>
Key fingerprint: BED5 B4F7 CCF5 D7B5 7C56 0505 9A0A A0FB C937 5975
Matt Adams
2005-02-01 18:32:26 UTC
Permalink
Hi Marcus:

Thanks for the heads-up. I check out 2.09!


Matt
--
Matt Adams <***@morcor.com>
Development Specialist
Morcor Solutions Inc. <http://www.morcor.com/>
(613) 354-2912 x228

GnuPG public key at <http://staff.morcor.com/~madams/>
Key fingerprint: BED5 B4F7 CCF5 D7B5 7C56 0505 9A0A A0FB C937 5975
Loading...