Apache-Voodoo
view release on metacpan or search on metacpan
lib/Apache/Voodoo/Install/Config.pm view on Meta::CPAN
################################################################################
#
# Apache::Voodoo::Install::Config - Apache Voodoo global settings writer
#
# This object is used by Voodoo internally by "voodoo-control setconfig".
#
################################################################################
package Apache::Voodoo::Install::Config;
$VERSION = "3.0200";
use strict;
use warnings;
# There doesn't seem to be another "user input prompt" mechanism installed
# by default other that this one. Seems kinda strange to have to use an
# object designed for make file creation for this...oh well.
use ExtUtils::MakeMaker qw{ prompt };
use Data::Dumper;
$Data::Dumper::Indent=1;
$Data::Dumper::Terse=1;
$Data::Dumper::Sortkeys=1;
sub new {
my $class = shift;
my %params = @_;
my $self = {};
if (defined($params{PREFIX})) {
# take whatever is supplied
foreach (keys %params) {
$self->{$_} = $params{$_};
}
}
bless ($self,$class);
return $self;
}
sub do_config_setup {
my $self = shift;
# get settings
$self->prefix();
$self->install_path();
$self->session_path();
$self->conf_path();
$self->updates_path();
$self->conf_file();
$self->tmpl_path();
$self->code_path();
$self->apache_uid();
$self->apache_gid();
$self->debug_dbd();
$self->debug_path();
return if $self->{"pretend"};
# save settings
my %cfg = %{$self};
my $path = $INC{"Apache/Voodoo/MyConfig.pm"} || $INC{"Apache/Voodoo/Install/Config.pm"};
$path =~ s/Install\/Config.pm$/MyConfig\.pm/;
open(OUT,">$path") || die "Can't write to $path: $!";
# I had this as a print block, but it tripped up the cpan.org formatter
print OUT "################################################################################\n";
print OUT "#\n";
print OUT "# Installation specific settings for Apache Voodoo are stored here.\n";
print OUT "# Do not edit this file directly. Use the \"voodoo-control\" command instead.\n";
print OUT "#\n";
print OUT "################################################################################\n";
print OUT "package Apache::Voodoo::MyConfig;\n";
print OUT "\n";
print OUT '$CONFIG = '. Dumper(\%cfg).";\n";
print OUT "\n";
print OUT "1;\n";
( run in 2.197 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )