Subject: | MP::Application doesn't work with MasonX::Maypole [patch] |
I sent an ugly hack to simon a while ago, but it was pretty poor. This patch is better, so you can just say
use Maypole::Application qw( -MasonX );
The format is diff -u
--- /usr/local/lib/perl5/site_perl/5.8.6/Maypole/Application.pm Tue Jan 25 21:53:08 2005
+++ /home/dave/distributions/Maypole-Application/lib/Maypole/Application.pm Sat Apr 23 01:03:33 2005
@@ -13,6 +13,23 @@
my ( $class, @plugins ) = @_;
my $caller = caller(0);
+ my ( $frontend, $masonx );
+
+ $frontend = 'Apache::MVC' if $ENV{MOD_PERL};
+
+ if ( grep { /^\-MasonX$/ } @plugins )
+ {
+ $masonx++;
+ @plugins = grep { ! /^\-MasonX$/ } @plugins;
+ $frontend = 'MasonX::Maypole';
+ }
+
+ $frontend ||= 'CGI::Maypole';
+
+ # should die here, not warn, but die is silent for some reason
+ $frontend->require or warn "Loading $frontend frontend failed: $@";
+ push @ISA, $frontend;
+
my $autosetup=0;
my @plugin_modules;
{
@@ -40,16 +57,8 @@
no strict 'refs';
push @{"${caller}::ISA"}, @plugin_modules, $class;
$caller->config(Maypole::Config->new);
+ $caller->config->masonx({}) if $masonx;
$caller->setup() if $autosetup;
-}
-
-if ( $ENV{MOD_PERL} ) {
- Apache::MVC->require or die "Loading Apache frontend failed: $@";
- push @ISA, 'Apache::MVC';
-}
-else {
- CGI::Maypole->require or die "Loading CGI frontend failed: $@";
- push @ISA, 'CGI::Maypole';
}
1;