From: Marcus Ramberg Date: Sun, 7 Nov 2004 23:56:37 +0000 (+0000) Subject: Ordering should not matter for parameters to ::Application. X-Git-Tag: 2.10~84 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=maypole.git;a=commitdiff_plain;h=a6edcc4c9b9950ee248e8e10839c86c8e31a129d Ordering should not matter for parameters to ::Application. Warn if setting up CDBI without DSN. git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@280 48953598-375a-da11-a14b-00016c27c3ee --- diff --git a/lib/Maypole/Application.pm b/lib/Maypole/Application.pm index fcbb13c..584b0e4 100644 --- a/lib/Maypole/Application.pm +++ b/lib/Maypole/Application.pm @@ -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} ) { diff --git a/lib/Maypole/Model/CDBI.pm b/lib/Maypole/Model/CDBI.pm index b4208e1..618076f 100644 --- a/lib/Maypole/Model/CDBI.pm +++ b/lib/Maypole/Model/CDBI.pm @@ -212,6 +212,7 @@ sub setup_database { $p ||= $config->pass; $opts ||= $config->opts; $config->dsn($dsn); + warn "No DSN set in config" unless $dsn; $config->loader || $config->loader( Class::DBI::Loader->new( namespace => $namespace,