From 3a9e643a6a5fa96ca69b56ced03db9569fd96e2e Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Wed, 2 Feb 2005 18:44:30 +0000 Subject: [PATCH] 2.09 - maintain the order that plugins are loaded, add tests for Maypole::Application, fix stickiness of addnew git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@336 48953598-375a-da11-a14b-00016c27c3ee --- Changes | 8 ++++++++ MANIFEST | 11 +++++----- META.yml | 2 +- lib/Apache/MVC.pm | 2 +- lib/CGI/Maypole.pm | 2 +- lib/Maypole.pm | 2 +- lib/Maypole/Application.pm | 42 ++++++++++++++++++++++---------------- templates/factory/addnew | 10 +++++---- 8 files changed, 48 insertions(+), 31 deletions(-) diff --git a/Changes b/Changes index ccc23d9..25939ee 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,14 @@ This file documents the revision history for Perl extension Maypole. For information about current developments and future releases, see: http://maypole.perl.org/?TheRoadmap +2.09 Mon Jan 25 22:00:00 2005 + Fixes: + - Fixed plugin inheritance set up by Maypole::Application, added tests + + Templates: + - factory/addnew will only prefill values when there's a row creation error + + 2.08 Mon Jan 24 20:45:00 2005 - Added $r->config->template_extension() to set optional file extension for templates (Dave Howorth) diff --git a/MANIFEST b/MANIFEST index d1482f0..f3321c3 100644 --- a/MANIFEST +++ b/MANIFEST @@ -28,14 +28,15 @@ MANIFEST MANIFEST.SKIP META.yml Module meta-data (added by MakeMaker) README -t/constants.t -t/maypole.t -t/apache_mvc.t -t/cgi_maypole.t -t/headers.t t/01basics.t t/02pod.t t/03podcoverage.t +t/apache_mvc.t +t/application.t +t/cgi_maypole.t +t/constants.t +t/headers.t +t/maypole.t t/templates/custom/classdata t/templates/custom/frontpage t/templates/custom/list diff --git a/META.yml b/META.yml index a9c08c6..0cc71cd 100644 --- a/META.yml +++ b/META.yml @@ -1,7 +1,7 @@ # http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: Maypole -version: 2.08 +version: 2.09 version_from: lib/Maypole.pm installdirs: site requires: diff --git a/lib/Apache/MVC.pm b/lib/Apache/MVC.pm index ce9e656..c7bfdef 100644 --- a/lib/Apache/MVC.pm +++ b/lib/Apache/MVC.pm @@ -1,6 +1,6 @@ package Apache::MVC; -our $VERSION = '2.08'; +our $VERSION = '2.09'; use strict; use warnings; diff --git a/lib/CGI/Maypole.pm b/lib/CGI/Maypole.pm index 7ea9ee7..f8c1229 100644 --- a/lib/CGI/Maypole.pm +++ b/lib/CGI/Maypole.pm @@ -6,7 +6,7 @@ use warnings; use CGI::Simple; use Maypole::Headers; -our $VERSION = '2.08'; +our $VERSION = '2.09'; sub run { my $self = shift; diff --git a/lib/Maypole.pm b/lib/Maypole.pm index 34e2ebb..2f3f75e 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -7,7 +7,7 @@ use Maypole::Config; use Maypole::Constants; use Maypole::Headers; -our $VERSION = '2.08'; +our $VERSION = '2.09'; __PACKAGE__->mk_classdata($_) for qw( config init_done view_object ); __PACKAGE__->mk_accessors( diff --git a/lib/Maypole/Application.pm b/lib/Maypole/Application.pm index 3336c1f..4f61f42 100644 --- a/lib/Maypole/Application.pm +++ b/lib/Maypole/Application.pm @@ -7,32 +7,38 @@ use Maypole; use Maypole::Config; our @ISA; -our $VERSION = '2.08'; +our $VERSION = '2.09'; sub import { - my ( $self, @plugins ) = @_; + my ( $class, @plugins ) = @_; my $caller = caller(0); - no strict 'refs'; - push @{"${caller}::ISA"}, $self; + my $autosetup=0; - foreach (sort @plugins) { - if (/^\-Setup$/) { $autosetup++; } - elsif (/^\-Debug$/) { - *{"$caller\::debug"} = sub { 1 }; - warn "Debugging enabled"; - } - elsif (/^-.*$/) { warn "Unknown flag: $_" } - else { - # The plugin caller should be our application class - eval "package $caller; require Maypole::Plugin::$_"; - if ($@) { warn qq(Loading plugin "Maypole::Plugin::$_" failed: $@) } + my @plugin_modules; + { + foreach (@plugins) { + if (/^\-Setup$/) { $autosetup++; } + elsif (/^\-Debug$/) { + no strict 'refs'; + *{"$caller\::debug"} = sub { 1 }; + warn "Debugging enabled"; + } + elsif (/^-.*$/) { warn "Unknown flag: $_" } else { - warn "Loaded plugin: Maypole::Plugin::$_" if $caller->debug; - push @{"${caller}::ISA"}, "Maypole::Plugin::$_"; + my $plugin = "Maypole::Plugin::$_"; + if ($plugin->require) { + push @plugin_modules, "Maypole::Plugin::$_"; + warn "Loaded plugin: $plugin" + if $caller->can('debug') && $caller->debug; + } else { + warn qq(Loading plugin "$plugin" failed: ) + . $UNIVERSAL::require::ERROR; + } } } } - + no strict 'refs'; + push @{"${caller}::ISA"}, @plugin_modules, $class; $caller->config(Maypole::Config->new); $caller->setup() if $autosetup; } diff --git a/templates/factory/addnew b/templates/factory/addnew index f530bc9..142dde6 100644 --- a/templates/factory/addnew +++ b/templates/factory/addnew @@ -20,10 +20,12 @@ table. -- 2.39.5