develooper Front page | perl.perl5.porters | Postings from July 2000

[PATCH]: my $var if|unless cleanup

From:
Daniel Muiño
Date:
July 26, 2000 14:37
Subject:
[PATCH]: my $var if|unless cleanup
Message ID:
397F5A59.99897084@afip.gov.ar

This is an attempt to make the cleanup against bleedperl:

--- ext/DB_File/Makefile.PL~  Sun May 28 18:04:04 2000
+++ ext/DB_File/Makefile.PL     Wed Jul 26 17:42:49 2000
@@ -2,7 +2,8 @@
 use Config ;
 
 # OS2 is a special case, so check for it now.
-my $OS2 = "-DOS2" if $Config{'osname'} eq 'os2' ;
+my $OS2;
+$OS2 = "-DOS2" if $Config{'osname'} eq 'os2' ;
 
 my $LIB = "-ldb" ;
 # so is win32
--- lib/CPAN.pm~        Wed Mar  1 16:08:34 2000
+++ lib/CPAN.pm Wed Jul 26 17:09:32 2000
@@ -1005,7 +1005,8 @@
        }
     }
 
-    my $msg = <<EOF unless $configpm =~ /MyConfig/;
+    my $msg;
+    $msg = <<EOF unless $configpm =~ /MyConfig/;
 
 # This is CPAN.pm's systemwide configuration file. This file provides
 # defaults for users, and the values can be changed in a per-user
--- lib/ExtUtils/LibList.pm~    Wed Jul 26 17:56:16 2000
+++ lib/ExtUtils/Liblist.pm     Wed Jul 26 17:58:56 2000
@@ -193,10 +193,11 @@
     # (caller should probably use the list in $Config{libs})
     return ("", "", "", "") unless $potential_libs;
 
+    my ($VC, $BC, $GC); 
+    $VC                = 1 if $cc =~ /^cl/i;
+    $BC                = 1 if $cc =~ /^bcc/i;
+    $GC                = 1 if $cc =~ /^gcc/i;
     my $cc             = $Config{cc};
-    my $VC             = 1 if $cc =~ /^cl/i;
-    my $BC             = 1 if $cc =~ /^bcc/i;
-    my $GC             = 1 if $cc =~ /^gcc/i;
     my $so             = $Config{'so'};
     my $libs           = $Config{'libs'};
     my $libpth         = $Config{'libpth'};
--- lib/Pod/Parser.pm~  Wed Jul 26 18:05:48 2000
+++ lib/Pod/Parser.pm   Wed Jul 26 17:13:37 2000
@@ -1152,7 +1152,8 @@
     my $self = shift;
     my %opts = (ref $_[0] eq 'HASH') ? %{ shift() } : ();
     my ($infile, $outfile) = @_;
-    my ($in_fh,  $out_fh) = (gensym, gensym)  if ($] < 5.6);
+    my ($in_fh,  $out_fh);
+    ($in_fh,  $out_fh) = (gensym, gensym)  if ($] < 5.6);
     my ($close_input, $close_output) = (0, 0);
     local *myData = $self;
     local $_;
--- lib/Test/Harness.pm~        Tue Jul 25 13:48:47 2000
+++ lib/Test/Harness.pm Wed Jul 26 17:14:39 2000
@@ -61,7 +61,8 @@
 
     local($ENV{'PERL5LIB'}) = $new5lib;
 
-    my @dir_files = globdir $files_in_dir if defined $files_in_dir;
+    my @dir_files;
+    @dir_files = globdir $files_in_dir if defined $files_in_dir;
     my $t_start = new Benchmark;
     while ($test = shift(@tests)) {
        $te = $test;
--- utils/h2xs.PL~      Wed Jul 26 17:16:54 2000
+++ utils/h2xs.PL       Wed Jul 26 18:11:40 2000
@@ -929,7 +929,8 @@
 EOD
 }
 
-my $pod = <<"END" unless $opt_P;
+unless ($opt_P) {
+    my $pod = <<"END";
 ## Below is stub documentation for your module. You better edit it!
 #
 #=head1 NAME
@@ -959,9 +960,9 @@
 #
 #=cut
 END
-
-$pod =~ s/^\#//gm unless $opt_P;
-print PM $pod unless $opt_P;
+    $pod =~ s/^\#//gm;
+    print PM $pod;
+}
 
 close PM;
--- utils/h2xs~       Wed Jul 26 18:17:16 2000
+++ utils/h2xs  Wed Jul 26 17:17:31 2000
@@ -373,10 +373,10 @@
 # -X implies -c and -f
 $opt_c = $opt_f = 1 if $opt_X;
 
-my %const_xsub = map { $_,1 } split(/,+/, $opt_s) if $opt_s;
+my %const_xsub; 
+%const_xsub = map { $_,1 } split(/,+/, $opt_s) if $opt_s;
 my $extralibs;
 my @path_h;
-
 
 while (my $arg = shift) {
     if ($arg =~ /^-l/i) {
--- win32/config_h.PL~  Wed Jul 26 18:20:53 2000
+++ win32/config_h.PL   Wed Jul 26 17:48:21 2000
@@ -2,7 +2,7 @@
 use Config;
 use File::Compare qw(compare);
 use File::Copy qw(copy);
-my $OBJ   = 1 if $Config{'ccflags'} =~ /PERL_OBJECT/i;
+my $OBJ = $Config{'ccflags'} =~ /PERL_OBJECT/i;
 my $name = $0;
 $name =~ s#^(.*)\.PL$#../$1.SH#;
 my %opt;
--- embed.pl~   Wed Jul 26 18:32:44 2000
+++ embed.pl    Wed Jul 26 18:31:49 2000
@@ -1028,7 +1028,7 @@
        return $ret if exists $skipapi_funcs{$func};
        if ($flags =~ /A/ && $flags !~ /j/) { # in public API, needed
for XSUBS
            $ret .= "\n";
-           my $addctx = 1 if $flags =~ /n/;
+           my $addctx = $flags =~ /n/;
            if ($flags =~ /p/) {
                $ret .= undefine("Perl_$func");
                $ret .= emit_func($addctx,$retval,"Perl_$func",@args);

Cheers,

Daniel

Jarkko Hietaniemi <jhi@iki.fi> writes:
>On Wed, Jul 26, 2000 at 09:13:02AM -1000, Tim Jenness wrote:
>>   my $var unless $something;
>> 
>> bug (since the 'my $var' doesn't always happen)
>
>There are more of those in bleedperl as
>
>       egrep 'my[ (][^#]* (if|unless)' **/*.{pl,PL,pm}
>
>will reveal.  (** is zsh-ism for recursive globbing)



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About