[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    FIX: admin/config.pl unusable with old perl versions
From:       Hans Meine <hans_meine () gmx ! net>
Date:       2005-06-15 9:57:19
Message-ID: 200506151157.19822.hans_meine () gmx ! net
[Download RAW message or body]

Hi!

In order to try compiling a 3.4 KDE on Solaris, I had to make the attached 
patch to config.pl due to a perl version incapable of "foreach my $foo ...".
It barked with
  Missing $ on loop variable at ../../arts/admin/config.pl line XXX.
where XXX in {63, 89, 197} (fixing one-by-one).

Finally, after fixing it told me what I already guessed: "Using perl older 
than version 5.005" ;-) and created the files.  Interestingly, I had to fix 
occurences in both the if($bad_perl) and the else-branch - maybe someone else 
would like to have a look at that again..

Ciao, /  /
     /--/
    /  / ANS

["config_pl.diff" (text/x-diff)]

--- kdelibs/admin/config.pl	2005-06-14 13:41:22.000000000 +0200
+++ arts/admin/config.pl	2005-06-15 11:49:46.000000000 +0200
@@ -53,6 +53,7 @@
 
 open(CF, "< $ac_subs") || die "can't open $ac_subs: $!";
 my @subs = <CF>;
+my $pat;
 close(CF);
 chomp @subs;
 @comp_match=();
@@ -60,7 +61,7 @@
 
 if ($bad_perl) {
     print "Using perl older than version 5.005\n";
-    foreach my $pat (@subs) {
+    foreach $pat (@subs) {
 	if (  ($pat =~ m/s%([^%]*)%([^%]*)%g/ )
 	   || ($pat =~ m/s%([^%]*)%([^%]*)%;t/ )
            || ($pat =~ m/s,([^,]*),(.*),;t/)
@@ -85,7 +86,7 @@
 	}
     }
 } else {
-    foreach my $pat (@subs) {
+    foreach $pat (@subs) {
        if ( ($pat =~ /s%([^%]*)%([^%]*)%g/ ) ||
             ($pat =~ /s%([^%]*)%([^%]*)%;t/ ) ||
             ($pat =~ /s,([^,]*),(.*),;t/) ) {
@@ -192,8 +193,9 @@
     my $filedata;
     my @infiles=split(' ', $infiles);
     my $i=0;
+    my $name;
 
-    foreach my $name (@infiles) {
+    foreach $name (@infiles) {
 	if (open(CF, "< $name")) {
 	    while (<CF>) {
 		$filedata .= $_;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic