Apache-Roaming

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

    my $httpd_path = $cfg->{'httpd_path'};
    if (!$httpd_path) {
	foreach my $dir (File::Spec->path()) {
	    my $file = File::Spec->catfile($dir, "httpd");
	    if (-x $file) {
		$httpd_path = $file;
		last;
	    }
	}
    }
    $cfg->{'httpd_path'} = prompt("Path of the Apache server: ",
				  $httpd_path || '/usr/sbin/httpd');
    die "Cannot execute HTTPD server $cfg->{'httpd_path'}: No such file"
	unless -x $cfg->{'httpd_path'};

    my $httpd_V_output = `$cfg->{'httpd_path'} -V`;
    my $httpd_conf_path =
	($httpd_V_output =~ /\s+-D\s+SERVER_CONFIG_FILE="(.*?)"/) ?
	    $1 : "/etc/httpd/httpd.conf";
    $cfg->{'httpd_conf_path'} = prompt("Path of the httpd.conf file: ",
				       $httpd_conf_path);
    my $httpd_conf_contents;
    die "Failed to read httpd config file $cfg->{'httpd_conf_path'}: $!"
	unless open(FILE, "<$cfg->{'httpd_conf_path'}");

    my(@module_list, $server_root);
    while (defined(my $line = <FILE>)) {
	if ($line =~ /\s*ServerRoot\s+\"?(.*?)\"?\s*$/) {
	    $server_root = $1;
	}

Makefile.PL  view on Meta::CPAN

	    if ($path !~ /^\//) {
		die "Cannot parse httpd config file $cfg->{'httpd_conf_path'}:"
		    . " Missing ServerRoot" unless $server_root;
		$_ = "LoadModule $module $server_root/$path\n";
	    }
	}
	$_;
    } @module_list;
    $cfg->{'dynamic_module_list'} = join("", @module_list);

    $cfg->{'httpd_user'} = prompt("HTTPD's UID for running tests: ",
				  $cfg->{'httpd_user'} || ('#' . $>));
    my $gid = $);
    $gid =~ s/\s.*//;
    $cfg->{'httpd_group'} = prompt("HTTPD's GID for running tests: ",
				   $cfg->{'httpd_group'} || ('#' . $gid));
    $cfg->{'httpd_port'} = prompt("Port to use for running tests: ",
				  $cfg->{'httpd_port'} || 8259);

    my $tdir = $cfg->{'t_dir'} = File::Spec->catdir(Cwd::getcwd(), "t");
    $cfg->{'httpd_conf'} = File::Spec->catfile($tdir, "httpd.cnf");
    $cfg->{'access_conf'} = File::Spec->catfile($tdir, "access.cnf");
    $cfg->{'srm_conf'} = File::Spec->catfile($tdir, "srm.cnf");
    $cfg->{'types_conf'} = File::Spec->catfile($tdir, "mime.types");
    $cfg->{'user_file'} = File::Spec->catfile($tdir, "htusers");
    my $log_dir = File::Spec->catdir($tdir, "logs");
    $cfg->{'log_dir'} = $log_dir;

Makefile.PL  view on Meta::CPAN

    $cfg->{'roaming_dir'} = File::Spec->catdir($o_dir, "roaming");

    my $dump = Data::Dumper->new([$cfg], ['cfg']);
    $dump->Indent(1);
    if (!open(STATUS, ">.status")  ||
	!(print STATUS $dump->Dump())  ||
	!close(STATUS)) {
	die "Error while creating file .status: $!";
    }

    my $reply = prompt("Do you want to configure the Apache::Roaming::LiPrefs module?", "y");
    if ($reply =~ /y/i) {
	foreach my $ref
	    (['Enable Autoupdate', 'bool', 'initial', 'autoupdate.enabled',
	      'false'],
	     ["Enable what's related?", 'bool', 'initial',
	      'browser.related.enabled', 'true'],
	     ['Startup Page', 'string', 'initial', 'browser.startup.page',
	      'none',
	      sub {
		  my $in = shift;

Makefile.PL  view on Meta::CPAN

  	     ['WAIS Proxy Port', 'string', 'initial',
	      'network.proxy.wais_port'],
  	     ['No Proxies for', 'string', 'initial',
  	      'network.proxy.no_proxies_on', '127.0.0.1 localhost'],
	     ['Send Email address as FTP password', 'bool', 'initial',
  	      'security.email_as_ftp_password', 'true'],
	     ['Send Warning while submitting an insecure POST', 'bool',
  	      'initial', 'security.warn_entering_secure', 'true'],
	     ['Send Warning while entering a secure area', 'bool', 'initial',
  	      'security.warn_submit_insecure', 'true']) {
		my($prompt, $type, $initial, $var, $default, $in_filter,
		   $out_filter) = @$ref;
		if (exists($Apache::Roaming::LiPrefs::ALWAYS{$var})) {
		    $initial = 'always';
		    $default = $Apache::Roaming::LiPrefs::ALWAYS{$var};
		} elsif (exists($Apache::Roaming::LiPrefs::INITIAL{$var})) {
		    $initial = 'initial';
		    $default = $Apache::Roaming::LiPrefs::INITIAL{$var};
		}
		$default = &$in_filter($default) if $in_filter;
		if ($type eq 'bool') {
		    if (defined($default)
			and  $default ne 'true'
			and  $default ne 'false') {
			$default = $default ? 'true' : 'false';
		    }
		}
		$default = defined($default) ?
		    prompt($prompt, $default) : prompt($prompt);
		if ($type eq 'bool') {
		    if (defined($default)
			and  $default ne 'true'
			and  $default ne 'false') {
			$default = $default ? 'true' : 'false';
		    }
		}
		$default = &$out_filter($default) if $out_filter;
		$initial = prompt("  Allow user to override this variable?",
				  ($initial eq 'initial') ? 'y' : 'n')
		    if defined($default);
		if ($initial =~ /y/i) {
		    delete $Apache::Roaming::LiPrefs::ALWAYS{$var};
		    $Apache::Roaming::LiPrefs::INITIAL{$var} = $default;
		    delete $Apache::Roaming::LiPrefs::INITIAL{$var}
			unless defined($default);
		} else {
		    delete $Apache::Roaming::LiPrefs::INITIAL{$var};
		    $Apache::Roaming::LiPrefs::ALWAYS{$var} = $default;	    



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