X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FMaypole%2FApplication.pm;h=c10221a8784bbf36be6cae136b523cd1f81ec23f;hb=f9a6b47b3b916585d710eac141003fb8261d9c3c;hp=e0c08fff70e6604f060c4d7f7b8b19ff1761eb0c;hpb=3d3d38f2f6639c90c98c72dc0167a82d52ce9ec4;p=maypole.git diff --git a/lib/Maypole/Application.pm b/lib/Maypole/Application.pm index e0c08ff..c10221a 100644 --- a/lib/Maypole/Application.pm +++ b/lib/Maypole/Application.pm @@ -3,22 +3,26 @@ package Maypole::Application; 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: $@) } @@ -28,6 +32,9 @@ sub import { } } } + + $caller->config(Maypole::Config->new); + $caller->setup() if $autosetup; } if ( $ENV{MOD_PERL} ) { @@ -49,6 +56,12 @@ Maypole::Application - Maypole Universal Frontend use Maypole::Application; + use Maypole::Application qw(Config::YAML); + + use Maypole::Application qw(-Debug Config::YAML -Setup); + + use Maypole::Application qw(Config::YAML Loader -Setup -Debug); + =head1 DESCRIPTION This is a universal frontend for mod_perl1, mod_perl2 and CGI.