[Maypole] Maypole::Application adds plugin classes to caller's @ISA

From: Matt Adams (matt.adams at morcor.com)
Date: Tue Feb 01 2005 - 18:05:50 GMT


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 <matt.adams at 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

_______________________________________________ maypole mailing list maypole at lists.netthink.co.uk http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:58 GMT