Apache-Voodoo
view release on metacpan or search on metacpan
lib/Apache/Voodoo/Application.pm view on Meta::CPAN
package Apache::Voodoo::Application;
$VERSION = "3.0200";
use strict;
use warnings;
use Apache::Voodoo::Constants;
use Apache::Voodoo::Application::ConfigParser;
use Apache::Voodoo::Session;
use Apache::Voodoo::Debug;
use Data::Dumper;
sub new {
my $class = shift;
my $self = {};
bless $self, $class;
# $self->{'debug'} = 1;
$self->{'id'} = shift;
$self->{'constants'} = shift || Apache::Voodoo::Constants->new();
die "ID is a required parameter." unless (defined($self->{'id'}));
$self->{'parser'} = Apache::Voodoo::Application::ConfigParser->new($self->{'id'},$self->{'constants'});
$self->refresh(1);
return $self;
}
sub config {
return $_[0]->{'parser'}->config();
}
sub databases {
return $_[0]->{'parser'}->databases();
}
sub bootstrapped {
my $self = shift;
$self->{debug_handler}->bootstrapped();
}
sub refresh {
my $self = shift;
my $initial = shift;
# If this is the initial load, or the config file has changed continue.
unless ($initial || $self->{'parser'}->changed()) {
return;
}
my $config = $self->{'parser'};
my %old_m = %{$config->models()};
my %old_v = %{$config->views()};
my %old_c = %{$config->controllers()};
my %old_i = %{$config->includes()};
my $old_ns = $config->old_ns();
$config->parse();
$self->_reload_modules('m',\%old_m,$config->models());
$self->_reload_modules('v',\%old_v,$config->views());
if (defined($old_ns) && $old_ns != $config->old_ns()) {
# They've swapped from the old style name for controller to the new syle
# (or vice versa). Drop all the old controllers.
( run in 0.542 second using v1.01-cache-2.11-cpan-39bf76dae61 )