From b160b52ac983eb36f723333fe75a04ea3cefa612 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 17 Oct 2012 16:30:44 +0000 Subject: perl_checker cleanups --- web_wizard/Apache.pm | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'web_wizard') diff --git a/web_wizard/Apache.pm b/web_wizard/Apache.pm index 1377877c..12d4687f 100755 --- a/web_wizard/Apache.pm +++ b/web_wizard/Apache.pm @@ -35,7 +35,7 @@ my $in = interactive->vnew; my $file = "/etc/httpd/conf/httpd.conf"; my $root; -my $config; +my $config; #FIXME: unused my $o = { name => N("Web wizard"), var => { @@ -55,7 +55,7 @@ my $o = { if (/^\s*#?\s*DocumentRoot\s+(.*)/) { close($FH); $root = $1; - $root =~ s/\"//g; + $root =~ s/"//g; last; } } @@ -104,14 +104,17 @@ $o->{pages} = { name => N("Type the name of the directory users should create in their homes (without ~/) to get it available via http://www.yourserver.com/~user"), pre => sub { $o->{var}{user_dir} = get_user_dir(); - if ($o->{var}{user_dir} =~ /disabled/ or !$o->{var}{user_dir}) { + if ($o->{var}{user_dir} =~ /disabled/ || !$o->{var}{user_dir}) { $o->{var}{user_dir} = 'public_html'; } }, complete => sub { if (!$o->{var}{user_dir}) { - $in->ask_warn(N('Error'), N('You must specify a user directory.')); return 1; - } else { return 0; }; }, + $in->ask_warn(N("Error"), N("You must specify a user directory.")); return 1; + } else { + return 0; + } + }, data => [ { label => N("user http sub-directory: ~/"), help => N("Type the name of the directory users should create in their homes (without ~/) to get it available via http://www.yourserver.com/~user"), val => \$o->{var}{user_dir} }, ], @@ -125,8 +128,11 @@ $o->{pages} = { ], complete => sub { if (! -d $o->{var}{shared_dir}) { - $in->ask_warn(N("Error"), N("The path you entered does not exist.")); return 1; } - else { return 0; }; + $in->ask_warn(N("Error"), N("The path you entered does not exist.")); + return 1; + } else { + return 0; + } }, next => 'summary', }, @@ -134,7 +140,7 @@ $o->{pages} = { name => N("Configuring the Web server") . "\n\n" . N("The wizard collected the following parameters needed to configure your Web server") . "\n\n" . N("To accept these values, and configure your server, click the Next button or use the Back button to correct them."), pre => sub { $o->{var}{internal} = $o->{var}{web_internal} ? N("enabled") : N("disabled"); - $o->{var}{external} = $o->{var}{web_external} ? N("enabled") : N("disabled") + $o->{var}{external} = $o->{var}{web_external} ? N("enabled") : N("disabled"); }, data => [ { label => N("Intranet web server:"), val_ref => \$o->{var}{internal} }, @@ -198,7 +204,7 @@ sub is_user_mod { sub is_last_user_mod { my $root = get_user_dir(); chomp($root); - !($root eq 'disabled'); + $root ne 'disabled'; } sub get_user_dir { @@ -234,7 +240,7 @@ EOF if ($o->{var}{user_mod}) { substInFile { s|(\s*)UserDir.*|$1UserDir $o->{var}{user_dir}|g; - s|{var}{user_dir}>|g; + s|{var}{user_dir}>|g; } $file; } else { substInFile { @@ -254,10 +260,10 @@ sub do_it { $that = "all"; } elsif ($o->{var}{web_internal} eq "1") { - ($that) = $wiz->{net}->itf_get("IPADDR") =~ qr/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.)\d{1,3}$/; + ($that) = $wiz->{net}->itf_get("IPADDR") =~ /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.)\d{1,3}$/; $that .= " 127.0.0.1"; } - cp_af($file, $file.".orig"); + cp_af($file, $file . ".orig"); substInFile { if (m/^\s*/s...m!^\s*!s) { { s/^\s*Allow .*$/ Allow from $that\n/s } @@ -267,9 +273,9 @@ sub do_it { chg_user_dir(); if (services::is_service_running('httpd')) { - services::restart('httpd') + services::restart('httpd'); } else { - services::start('httpd') + services::start('httpd'); } undef $w; check_started($o->{var}{servicecheck}); -- cgit v1.2.1