Apache-Voodoo
view release on metacpan or search on metacpan
lib/Apache/Voodoo/Application/ConfigParser.pm view on Meta::CPAN
else {
die "ID is a required parameter.";
}
return $self;
}
sub changed {
my $self = shift;
return $self->{'conf_mtime'} != (stat($self->{'conf_file'}))[9];
}
sub old_ns { return $_[0]->{'old_ns'} };
sub config { return $_[0]->{'config'} };
sub models { return $_[0]->{'models'} };
sub views { return $_[0]->{'views'} };
sub controllers { return $_[0]->{'controllers'} };
sub includes { return $_[0]->{'includes'} };
sub template_conf { return $_[0]->{'template_conf'} };
sub databases { return $_[0]->{'dbs'} };
lib/Apache/Voodoo/Application/ConfigParser.pm view on Meta::CPAN
$conf{'halt_on_errors'} = 1;
}
}
else {
$conf{'devel_mode'} = 0;
$conf{'dynamic_loading'} = $conf{'dynamic_loading'} || 0;
$conf{'halt_on_errors'} = defined($conf{'halt_on_errors'})?$conf{'halt_on_errors'}:1;
}
if ($conf{'dynamic_loading'}) {
$self->{'conf_mtime'} = (stat($self->{'conf_file'}))[9];
}
if (defined($conf{'database'})) {
my $db;
if (ref($conf{'database'}) eq "ARRAY") {
$db = $conf{'database'};
}
else {
$db = [ $conf{'database'} ];
}
lib/Apache/Voodoo/Debug/Handler.pm view on Meta::CPAN
# holds all vars associated with this page processing request
my $uri = $self->{mp}->uri();
$uri =~ s/^$self->{debug_root}//;
$uri =~ s/^\///;
if (defined($self->{static_files}->{$uri})) {
# request for one of the static files.
my $file = File::Spec->catfile($self->{template_dir},$uri);
my $mtime = (stat($file))[9];
# Handle "if not modified since" requests.
$r->update_mtime($mtime);
$r->set_last_modified;
$r->meets_conditions;
my $rc = $self->{mp}->if_modified_since($mtime);
return $rc unless $rc == $self->{mp}->ok;
# set the content type
$self->{mp}->content_type($self->{static_files}->{$uri});
lib/Apache/Voodoo/Install.pm view on Meta::CPAN
sub make_symlink {
my $self = shift;
my $source = shift;
my $target = shift;
my $pretend = $self->{'pretend'};
$self->info("- Checking symlink $target");
lstat($target);
if (-e _ && -l _ ) {
# it's there and it's a link, let's make sure it points to the correct place.
my @ss = stat($target);
my @ts = stat($source);
if ($ss[1] != $ts[1]) {
# inode's are different.
$pretend || unlink($target) || $self->{ignore} || die "Can't remove bogus link: $!";
$pretend || symlink($source,$target) || $self->{ignore} || die "Can't create symlink: $!";
$self->debug(": invalid, fixed");
}
else {
$self->debug(": ok");
}
}
lib/Apache/Voodoo/Install.pm view on Meta::CPAN
sub make_writeable_dirs {
my $self = shift;
my @dirs = shift;
my $pretend = $self->{'pretend'};
my $uid = $self->{'apache_uid'};
my $gid = $self->{'apache_gid'};
foreach my $dir (@dirs) {
$self->info("- Checking directory $dir");
stat($dir);
if (-e _ && -d _ ) {
$self->debug(": ok");
}
else {
$pretend || mkdir($dir,770) || $self->{ignore} || die "Can't create directory $dir: $!";
$self->debug(": created");
}
$self->info("- Making sure the $dir directory is writable by apache");
$pretend || chown($uid,$gid,$dir) || $self->{ignore} || die "Can't chown directory: $!";
$pretend || chmod(0770,$dir) || $self->{ignore} || die "Can't chmod directory: $!";
lib/Apache/Voodoo/Loader/Dynamic.pm view on Meta::CPAN
sub get_mtime {
my $self = shift;
my $file = shift || $self->{'module'};
$file =~ s/::/\//go;
$file .= ".pm";
return 0 unless defined($INC{$file});
my $mtime = (stat($INC{$file}))[9];
return $mtime;
}
sub refresh {
my $self = shift;
$self->{'object'} = $self->load_module;
$self->{'mtime'} = $self->get_mtime;
lib/Apache/Voodoo/View/HTML/Theme.pm view on Meta::CPAN
my $p = shift;
my $session = $p->{'session'};
# check for an override of what's in the template conf file.
my $sys_override = $p->{'document_root'}."/.theme_conf";
my $chosen_theme = $self->{'default'};
if (-e $sys_override && -s $sys_override) {
my $mtime = (stat($sys_override))[9];
if (!defined($self->{'sys_theme'}->{'mtime'}) || $self->{'sys_theme'}->{'mtime'} ne $mtime) {
unless(open(T,$sys_override)) {
die "Can't open $sys_override: $!";
}
my $t = <T>;
chomp($t);
close(T);
if ($t ne "default" && defined($self->{'themes'}->{$t})) {
$chosen_theme = $t;
$self->{'sys_theme'}->{'name'} = $t;
}
$self->{'sys_theme'}->{'mtime'} = (stat($sys_override))[9];
}
else {
$chosen_theme = $self->{'sys_theme'}->{'name'};
}
}
if ($self->{'user_set'}) {
my $user_theme = $session->{'user_theme'};
if (defined($user_theme) && $user_theme ne "default") {
if (defined($self->{'themes'}->{$user_theme})) {
lib/Apache/Voodoo/View/HTML/Theme.pm view on Meta::CPAN
sub _load {
my $self = shift;
my $file = shift;
my $record;
my $config_general = Config::General->new($file);
my %conf = $config_general->getall;
$record->{'mtime'} = (stat($file))[9];
foreach my $style (keys %{$conf{'style'}}) {
$record->{'style'}->{$style}->{'skeleton'} = $conf{'style'}->{$style}->{'skeleton'};
$record->{'style'}->{$style}->{'includes'} = $conf{'style'}->{$style}->{'includes'};
foreach my $page (keys %{$conf{'style'}->{$style}->{'pages'}}) {
$record->{'pages'}->{$page} = $conf{'style'}->{$style}->{'pages'}->{$page};
$record->{'pages'}->{$page}->{'__style__'} = $style;
}
}
return $record;
}
sub _is_stale {
my $self = shift;
my $file = shift;
return 1 unless defined($self->{'cache'}->{$file});
return ($self->{'cache'}->{$file}->{'mtime'} != (stat($file))[9]);
}
sub get_skeleton {
return shift->{'skeleton'};
}
1;
################################################################################
# Copyright (c) 2005-2010 Steven Edwards (maverick@smurfbane.org).
( run in 1.141 second using v1.01-cache-2.11-cpan-49f99fa48dc )