4 my $targ = (@ARGV) ? join(' ',@ARGV) : 'miniperl' ;
9 open(PIPE,"make $targ 2>&1 |") || die "Cannot open pipe to make:$!";
13 if (/^(.*):(\d+):\s+\`(\w+)'\s+undeclared/ && -f $1 )
15 my ($file,$line,$var) = ($1,$2,$3);
16 $fix{$file} = [] unless exists $fix{$file};
17 push(@{$fix{$file}},[$line => $var]) unless ($var =~ /^PL_/ || $file =~ /\.h$/);
22 warn "Make retured $?\n";
25 foreach my $file (keys %fix)
27 my @ar = sort( { $a->[0] <=> $b->[0] } @{delete $fix{$file}});
32 system("d4","edit",$file);
39 while (@ar && $. == $ar[0][0])
41 my ($line,$var) = @{shift(@ar)};
42 if (s/\b$var\b/PL_$var/)
44 warn "$file:$line: FIX $var\n";
50 push(@miss,[$line,$var,$_]);
57 rename("$file$^I",$file);
62 my ($line,$var,$txt) = @{shift(@miss)};
63 warn "$file:$line:$var | $txt";