Apache-Voodoo

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

	add_mp2(\%required_modules);
}
elsif ($mod_perl::VERSION > 0) {
	print "Adding prequisites for mod_perl Version 1 API...\n";
	add_mp1(\%required_modules);
}
else {
	my $answer;
	print "\nCan't find mod_perl.pm or mod_perl2.pm, one of which is required.\n\n";
	while ($answer != /^[12]$/) {
		$answer = prompt("Do you want to use Apache 1.X or Apache 2.X? (1/2)",2);
		chomp($answer);
	}

	if ($answer == 1) {
		add_mp1(\%required_modules);
	}
	else {
		add_mp2(\%required_modules);
	}
}

eval { require SOAP::Transport::HTTP; };
if ($@) {
	print "\nApache::Voodoo can also optionally serve SOAP requests.\n";
	my $answer;
	while ($answer !~ /^[yn]/i) {
		$answer = prompt("Would you like me to add the dependencies to enable this feature? (y/n)",'y');
		chomp($answer);
	}

	if ($answer =~ /^y/i) {
		$required_modules{'SOAP::Lite'} = $optionals{'SOAP::Lite'};
		print "Adding prequisites for SOAP...\n";
	}
}
else {
	$required_modules{'SOAP::Lite'} = $optionals{'SOAP::Lite'};

Makefile.PL  view on Meta::CPAN

		# they do, remove this dependancy
		delete $required_modules{'Pod::WSDL'};
	}
}

eval { require Log::Log4perl; };
if ($@) {
	print "\nApache::Voodoo can log debugging message with Log4perl.\n";
	my $answer;
	while ($answer !~ /^[yn]/i) {
		$answer = prompt("Would you like me to add the dependencies to enable this feature? (y/n)",'y');
		chomp($answer);
	}

	if ($answer =~ /^y/i) {
		$required_modules{'Log::Log4perl'} = $optionals{'Log::Log4perl'};
		print "Adding prequisites for Log4perl...\n";
	}
}
else {
	$required_modules{'Log::Log4perl'} = $optionals{'Log::Log4perl'};

lib/Apache/Voodoo/Install/Config.pm  view on Meta::CPAN

# 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 = @_;

lib/Apache/Voodoo/Install/Config.pm  view on Meta::CPAN

		# test some of the common apache install locations to come up with a sensible default.
		foreach ("/data/apache","/usr/local/apache","/etc/apache/","/etc/apache2") {
			if (-e $_ && -d $_) {
				$self->{PREFIX} = $_;
				last;
			}
		}
	}

	while (1) {
		my $ans = prompt("Apache Prefix Path",$self->{PREFIX});
		$ans =~ s/\/$//;

		if (-e $ans && -d $ans) {
			$self->{PREFIX} = $ans;
			last;
		}

		print "That directory doesn't exist.  Please try again.\n";
	}
}

sub install_path {
	my $self = shift;

	unless ($self->{INSTALL_PATH}) {
		$self->{INSTALL_PATH} = $self->{PREFIX} . "/sites";
	}

	$self->{INSTALL_PATH} = prompt("App Install Path",$self->{INSTALL_PATH});
	$self->{INSTALL_PATH} =~ s/\/$//;
}

sub session_path {
	my $self = shift;

	unless ($self->{SESSION_PATH}) {
		$self->{SESSION_PATH} = $self->{PREFIX} . "/session";
	}

	$self->{SESSION_PATH} = prompt("Session Path",$self->{SESSION_PATH});
	$self->{SESSION_PATH} =~ s/\/$//;
}

sub conf_path {
	my $self = shift;

	unless ($self->{CONF_PATH}) {
		$self->{CONF_PATH} = "etc";
	}

	$self->{CONF_PATH} = prompt("Config File Path (relative to App Install Path)",$self->{CONF_PATH});
	$self->{CONF_PATH} =~ s/\/$//;
}

sub conf_file {
	my $self = shift;

	unless ($self->{CONF_FILE}) {
		$self->{CONF_FILE} = "etc/voodoo.conf";
	}

	$self->{CONF_FILE} = prompt("Config File Name (relative to App Install Path)",$self->{CONF_FILE});
	$self->{CONF_FILE} =~ s/\/$//;
}

sub updates_path {
	my $self = shift;

	unless ($self->{UPDATES_PATH}) {
		$self->{UPDATES_PATH} = "etc/updates";
	}

	$self->{UPDATES_PATH} = prompt("Update File Path (relative to App Install Path)",$self->{UPDATES_PATH});
	$self->{UPDATES_PATH} =~ s/\/$//;
}

sub tmpl_path {
	my $self = shift;

	unless ($self->{TMPL_PATH}) {
		$self->{TMPL_PATH} = "html";
	}

	$self->{TMPL_PATH} = prompt("Template File Path (relative to App Install Path)",$self->{TMPL_PATH});
	$self->{TMPL_PATH} =~ s/\/$//;
}

sub code_path {
	my $self = shift;

	unless ($self->{CODE_PATH}) {
		$self->{CODE_PATH} = "code";
	}

	$self->{CODE_PATH} = prompt("Perl Module Path (relative to App Install Path)",$self->{CODE_PATH});
	$self->{CODE_PATH} =~ s/\/$//;
}

sub apache_uid {
	my $self = shift;

	my $default = "apache";
	if ($self->{'APACHE_UID'}) {
		my $d = (getpwuid($self->{APACHE_UID}))[0];
		$default = $d if ($d);
	}

	while (1) {
		my $apache = prompt("User that Apache runs as",$default);
		my (undef,undef,$uid,undef) = getpwnam($apache);
		if ($uid =~ /^\d+$/) {
			$self->{'APACHE_UID'} = $uid;
			last;
		}
		print "Can't find this user.  Please try again.\n";
	}
}

sub apache_gid {
	my $self = shift;

	my $default = "apache";
	if ($self->{'APACHE_GID'}) {
		my $d = (getgrgid($self->{APACHE_GID}))[0];
		$default = $d if ($d);
	}

	while (1) {
		my $apache = prompt("Group that Apache runs as",$default);
		my (undef,undef,undef,$gid) = getpwnam($apache);
		if ($gid =~ /^\d+$/) {
			$self->{'APACHE_GID'} = $gid;
			last;
		}
		print "Can't find this group.  Please try again.\n";
	}
}

sub debug_dbd {
	my $self = shift;

	unless ($self->{DEBUG_DBD}) {
		$self->{DEBUG_DBD} = ['dbi:SQLite:dbname=/tmp/apachevoodoo.db','',''];
	}

	$self->{DEBUG_DBD}->[0] = prompt("Debug Database Connect", $self->{DEBUG_DBD}->[0]);
	$self->{DEBUG_DBD}->[1] = prompt("Debug Database Username",$self->{DEBUG_DBD}->[1]);
	$self->{DEBUG_DBD}->[2] = prompt("Debug Database Password",$self->{DEBUG_DBD}->[2]);
}

sub debug_path {
	my $self = shift;

	unless ($self->{DEBUG_PATH}) {
		$self->{DEBUG_PATH} = "/debug";
	}

	$self->{DEBUG_PATH} = prompt("URL Path to the debug handler",$self->{DEBUG_PATH});
}

1;

################################################################################
# Copyright (c) 2005-2010 Steven Edwards (maverick@smurfbane.org).
# All rights reserved.
#
# You may use and distribute Apache::Voodoo under the terms described in the
# LICENSE file include in this package. The summary is it's a legalese version



( run in 0.976 second using v1.01-cache-2.11-cpan-6aa56a78535 )