]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/Maypole/Application.pm
Ordering should not matter for parameters to ::Application.
[maypole.git] / lib / Maypole / Application.pm
index fcbb13cadbae123204652dbb24b3a22770ff1e63..584b0e4e2f40790ee1d5fd81e22cbb49ba28def6 100644 (file)
@@ -12,15 +12,15 @@ sub import {
     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 +30,7 @@ sub import {
             }
         }
     }
+    $caller->setup() if $autosetup;
 }
 
 if ( $ENV{MOD_PERL} ) {