Apache-Roaming
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
$_;
} @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;
$cfg->{'access_log'} = File::Spec->catfile($log_dir, "access.log");
$cfg->{'error_log'} = File::Spec->catfile($log_dir, "error.log");
$cfg->{'lock_file'} = File::Spec->catfile($log_dir, "httpd.lck");
$cfg->{'pid_file'} = File::Spec->catfile($log_dir, "httpd.pid");
my $o_dir = $cfg->{'output_dir'} = File::Spec->catdir($tdir, "output");
$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;
$in = 'none' if !defined($in) or $in eq '0';
$in;
},
sub {
my $out = shift;
$out = '0' if !defined($out) or $out eq 'none';
}],
['By default send HTML mail', 'bool', 'initial',
'mail.html_compose', 'false'],
['Default domain', 'string', 'initial',
'mail.identity.defaultdomain'],
['Leave mail on server', 'bool', 'initial',
'mail.leave_on_server', 'false'],
['Remember mail password', 'bool', 'initial',
'mail.remember_password', 'false'],
['Default NNTP server', 'string', 'initial',
'network.hosts.nntp_server'],
['Default POP3 server', 'string', 'initial',
'network.hosts.pop_server'],
['Default SMTP server', 'string', 'initial',
'network.hosts.smtp_server'],
['Proxy autoconfiguration URL', 'string', 'initial',
'network.proxy.autoconfig_url'],
['FTP Proxy', 'string', 'initial',
'network.proxy.ftp'],
['FTP Proxy Port', 'string', 'initial',
'network.proxy.ftp_port'],
['Gopher Proxy', 'string', 'initial',
'network.proxy.gopher'],
['Gopher Proxy Port', 'string', 'initial',
'network.proxy.gopher_port'],
['HTTP Proxy', 'string', 'initial',
'network.proxy.http'],
['HTTP Proxy Port', 'string', 'initial',
'network.proxy.http_port'],
['SSL Proxy', 'string', 'initial',
'network.proxy.ssl'],
['SSL Proxy Port', 'string', 'initial',
'network.proxy.ssl_port'],
['WAIS Proxy', 'string', 'initial',
'network.proxy.wais'],
['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;
delete $Apache::Roaming::LiPrefs::ALWAYS{$var}
unless defined($default);
}
}
}
}
if (!open(CONF, ">$cfg->{'access_conf'}") || !close(CONF)) {
die "Error while writing $cfg->{'access_conf'}: $!";
}
if (!open(CONF, ">$cfg->{'srm_conf'}") || !close(CONF)) {
die "Error while writing $cfg->{'srm_conf'}: $!";
}
if (!open(CONF, ">$cfg->{'types_conf'}") || !close(CONF)) {
die "Error while writing $cfg->{'types_conf'}: $!";
}
my $config_dir = File::Spec->catdir(File::Spec->curdir(),
( run in 4.791 seconds using v1.01-cache-2.11-cpan-f56aa216473 )