]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/Maypole/Application.pm
accidentally committed view_options with /home directory
[maypole.git] / lib / Maypole / Application.pm
index fcbb13cadbae123204652dbb24b3a22770ff1e63..c10221a8784bbf36be6cae136b523cd1f81ec23f 100644 (file)
@@ -4,23 +4,25 @@ use strict;
 use warnings;
 use UNIVERSAL::require;
 use Maypole;
+use Maypole::Config;
 
 our @ISA;
+our $VERSION = '2.05';
 
 sub import {
     my ( $self, @plugins ) = @_;
     my $caller = caller(0);
     no strict 'refs';
     push @{"${caller}::ISA"}, $self;
-    foreach (@plugins) {
-        if    (/^\-Setup$/) { $caller->setup }
+    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: $@) }
@@ -30,6 +32,9 @@ sub import {
             }
         }
     }
+
+    $caller->config(Maypole::Config->new);
+    $caller->setup() if $autosetup;
 }
 
 if ( $ENV{MOD_PERL} ) {