From: wdconsta Date: Tue, 8 Jul 1997 02:30:44 +0000 (+1200) Subject: h2ph corrections to avoid redefined sub warnings X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=46f24c54ba4249e3ea156261098960de79140a11;p=p5sagit%2Fp5-mst-13.2.git h2ph corrections to avoid redefined sub warnings Subject: [PATCH] possible h2ph corrections? i've been getting a whole bunch of redefined sub warnings from my sys/termios.ph, so here's a fix (well, i don't get the warnings anymore :) p5p-msgid: Pine.SV4.3.93.970708143446.23808A-100000@florence.teaching.cs.adelaide.edu.au --- diff --git a/utils/h2ph.PL b/utils/h2ph.PL index 3471300..6a19b41 100644 --- a/utils/h2ph.PL +++ b/utils/h2ph.PL @@ -116,10 +116,10 @@ foreach $file (@ARGV) { if ($t ne '') { $new =~ s/(['\\])/\\$1/g; print OUT $t, - "eval 'sub $name $proto\{\n$t ${args}eval \"$new\";\n$t}';\n"; + "eval 'sub $name $proto\{\n$t ${args}eval \"$new\";\n$t}' unless defined(\&$name);\n"; } else { - print OUT "sub $name $proto\{\n ${args}eval \"$new\";\n}\n"; + print OUT "unless defined(\&$name) {\nsub $name $proto\{\n ${args}eval \"$new\";\n}\n}\n"; } %curargs = (); } @@ -129,10 +129,10 @@ foreach $file (@ARGV) { $new = 1 if $new eq ''; if ($t ne '') { $new =~ s/(['\\])/\\$1/g; - print OUT $t,"eval 'sub $name () {",$new,";}';\n"; + print OUT $t,"eval 'sub $name () {",$new,";}' unless defined(\&$name);\n"; } else { - print OUT $t,"sub $name () {",$new,";}\n"; + print OUT $t,"unless(defined(\&$name) {\nsub $name () {",$new,";}\n}\n"; } } }