summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2003-11-14 13:32:27 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2003-11-14 13:32:27 +0000
commit100b4731827c03739ee6b1d4ebb8924b303fb91d (patch)
treef4787cffa48d6067f2877ad3f09bdb6a168229ef
parent683b057b1597646dc3589871add6e3b662a8ddb1 (diff)
downloaddrakwizard-100b4731827c03739ee6b1d4ebb8924b303fb91d.tar
drakwizard-100b4731827c03739ee6b1d4ebb8924b303fb91d.tar.gz
drakwizard-100b4731827c03739ee6b1d4ebb8924b303fb91d.tar.bz2
drakwizard-100b4731827c03739ee6b1d4ebb8924b303fb91d.tar.xz
drakwizard-100b4731827c03739ee6b1d4ebb8924b303fb91d.zip
perl_checker fixes
-rw-r--r--server_wizard/scripts/Serverconf.pm9
-rwxr-xr-xweb_wizard/Apache.pm12
-rwxr-xr-xwiz2fake_c.pl15
-rw-r--r--wpo2po.pl21
4 files changed, 30 insertions, 27 deletions
diff --git a/server_wizard/scripts/Serverconf.pm b/server_wizard/scripts/Serverconf.pm
index 23a0eb91..0ef2267d 100644
--- a/server_wizard/scripts/Serverconf.pm
+++ b/server_wizard/scripts/Serverconf.pm
@@ -1,12 +1,13 @@
#!/usr/bin/perl
package Serverconf;
-require "/usr/share/wizards/common/scripts/Vareqval.pm";
-require "/usr/share/wizards/common/scripts/IFCFG.pm";
+use lib qw(/usr/lib/perl5/vendor_perl/5.8.1/MDK/Wizard/ /usr/share/wizards/common/scripts/);
+require Vareqval;
+require IFCFG;
use MDK::Common;
use strict;
-my $o = IFCFG->new();
+my $o = IFCFG->new;
sub get_hostname {
my $host = $o->network_get("HOSTNAME");
@@ -133,7 +134,7 @@ sub do_it {
open(OLD, "< $file") or die "can not open $file";
open(NEW, "> $tmp") or die "can not open $tmp";
while (<OLD>) {
- if (/^\s*(?!\#)*\s*$old_ip.*$/) {
+ if (/^\s*(?!#)*\s*$old_ip/) {
print NEW "# removed by mdk_serv script on $date
#$_
$new_ip\t$hostname\n";
diff --git a/web_wizard/Apache.pm b/web_wizard/Apache.pm
index 12e9d9f5..e23c12fa 100755
--- a/web_wizard/Apache.pm
+++ b/web_wizard/Apache.pm
@@ -49,7 +49,7 @@ my $o = {
if (-f $file) {
open my $FH, $file or die "$! ($file)";
while (<$FH>) {
- if (/^\s*\#?\s*DocumentRoot\s+(.*)/) {
+ if (/^\s*#?\s*DocumentRoot\s+(.*)/) {
close($FH);
$root = $1;
last;
@@ -86,7 +86,7 @@ $o->{pages} = {
},
ask_mod => {
name => N("Modules :") . "\n\n" . N("* User module : allows users to have a directory in their home directories available on your http server via http://www.yourserver.com/~user, you will be asked for the name of this directory afterward."),
- pre => sub { $o->{var}{user_mod} = is_last_user_mod()},
+ pre => sub { $o->{var}{user_mod} = is_last_user_mod() },
data => [
{ text => N("Allows users to get a directory in their homes directories
available on your http server via http://www.yourserver.com/~user."), type => 'bool', val => \$o->{var}{user_mod} },
@@ -171,7 +171,7 @@ sub check_dir {
sub chg_docroot {
my $old;
substInFile {
- s|(^\s*\#?\s*DocumentRoot\s*)(\S*).*|$1$o->{var}{shared_dir}| and $old ||=$2;
+ s|(^\s*#?\s*DocumentRoot\s*)(\S*).*|$1$o->{var}{shared_dir}| and $old ||= $2;
} $file;
substInFile {
@@ -234,9 +234,9 @@ sub do_it {
}
cp_af($file, $file.".orig");
substInFile {
- if( m /^\s*<Directory.*>/s...m/^\s*<\/Directory>/s ) {
- { s /^\s*Allow .*$/ Allow from $that\n/s;}
- ;}
+ if (m/^\s*<Directory.*>/s...m!^\s*</Directory>!s) {
+ { s/^\s*Allow .*$/ Allow from $that\n/s }
+ }
} $file;
chg_docroot();
chg_user_dir();
diff --git a/wiz2fake_c.pl b/wiz2fake_c.pl
index 635eb6d9..879f9539 100755
--- a/wiz2fake_c.pl
+++ b/wiz2fake_c.pl
@@ -11,7 +11,7 @@ sub wrap {
}
sub load_wpo {
- my ($tree, $tag ,$page) = @_;
+ my ($tree, $tag, $page) = @_;
foreach my $leaf (@$tree) {
if (ref($leaf) eq 'ARRAY') {
@@ -26,7 +26,7 @@ sub load_wpo {
$page->{$leaf->{helpText}} = "";
$page->{$leaf->{description}} = "";
$page->{$leaf->{nextButtonText}} = "";
- } elsif(ref($leaf)=~ /\w\D/){
+ } elsif (ref($leaf) =~ /\w\D/) {
$tag = $leaf;
}
}
@@ -37,13 +37,14 @@ my $xmltree = XML::Parser->new(Style => 'Tree')->parsefile($ARGV[0]);
my $wpo = load_wpo($xmltree);
print STDERR "$ARGV[0] => ";
-my $fullname = "$ARGV[0]"."_.c";
+my $fullname = $ARGV[0] . "_.c";
-open(PO, "> $fullname");
+my $PO;
+open($PO, "> $fullname");
-foreach (keys %{$wpo}) {
+foreach (keys %$wpo) {
# print "$_\n";
- $_ ne "" and print PO "printf(_(\"$_\"));\n";
+ $_ ne "" and print $PO qq(printf(_("$_"));\n);
}
-close PO;
+close $PO;
print STDERR "$fullname\n";
diff --git a/wpo2po.pl b/wpo2po.pl
index a06e98b6..47f317db 100644
--- a/wpo2po.pl
+++ b/wpo2po.pl
@@ -4,7 +4,7 @@ use XML::Parser;
sub load_wpo {
- my ($tree, $tag ,$page) = @_;
+ my ($tree, $tag, $page) = @_;
foreach my $leaf (@$tree) {
if (ref($leaf) eq 'ARRAY') {
@@ -18,7 +18,7 @@ sub load_wpo {
$leaf->{from} =~ s/\\q/\\\\q/g;
$leaf->{from} =~ s/\\a/\\\\a/g;
$page->{$leaf->{from}} = $leaf->{to};
- }elsif(ref($leaf)=~ /\w\D/){
+ } elsif (ref($leaf) =~ /\w\D/) {
$tag = $leaf;
}
}
@@ -50,32 +50,33 @@ my %lang = (fr => '"Language-Team: French <fr@li.org>\n"
"Content-Transfer-Encoding: 8bit\n"');
print STDERR "$ARGV[0] =>";
-$ARGV[0] =~ /.*\/(.*)\.(.*)\..*/;
+$ARGV[0] =~ m!.*/(.*)\.(.*)\.!;
-open(PO, "> ./po/$1_$2.po");
+my $PO;
+open($PO, "> ./po/$1_$2.po");
my $date = `date +%Y-%m-%d\\ %H:%M%z`;
chomp $date;
-print PO 'msgid ""
+print $PO 'msgid ""
msgstr ""
"Project-Id-Version: drakwizard 0.1\n"
"POT-Creation-Date: '.$date.'\n"
"PO-Revision-Date: '.$date.'\n"
"Last-Translator: Arnaud Desmons <adesmons@mandrakesoft.com>\n"
-'.$lang{"$2"}.'
+'.$lang{$2}.'
"X-Generator: wpo2pl 0.1\n"
';
-foreach (keys %{$wpo}) {
+foreach (keys %$wpo) {
if ($_ ne "") {
if ($_ eq $wpo->{$_}) {
- print PO "msgid \"$_\"\nmsgstr \"\"\n\n";
+ print $PO qq(msgid "$_"\nmsgstr ""\n\n);
}
else {
- print PO "msgid \"$_\"\nmsgstr \"$wpo->{$_}\"\n\n";
+ print $PO qq(msgid "$_"\nmsgstr "$wpo->{$_}"\n\n);
}
}
}
-close PO;
+close $PO;
print STDERR "./po/$1_$2.po\n";