From a6edcc4c9b9950ee248e8e10839c86c8e31a129d Mon Sep 17 00:00:00 2001 From: Marcus Ramberg Date: Sun, 7 Nov 2004 23:56:37 +0000 Subject: [PATCH] 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 --- lib/Maypole/Application.pm | 7 ++++--- lib/Maypole/Model/CDBI.pm | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) 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, -- 2.39.2