Ticket #138: 0004-Trivial-perl.req-cleanups.patch

File 0004-Trivial-perl.req-cleanups.patch, 3.0 kB (added by scop, 2 years ago)
  • a/scripts/perl.req

    old new  
    1919 
    2020# a simple makedepend like script for perl. 
    2121 
    22 # To save development time I do not parse the perl grammmar but 
     22# To save development time I do not parse the perl grammar but 
    2323# instead just lex it looking for what I want.  I take special care to 
    2424# ignore comments and pod's. 
    2525 
     
    5454} 
    5555 
    5656 
     57foreach $perlver (sort keys %perlreq) { 
     58  print "perl >= $perlver\n"; 
     59} 
    5760foreach $module (sort keys %require) { 
    5861  if (length($require{$module}) == 0) { 
    5962    print "perl($module)\n"; 
     
    151154         \s*([.0-9]*) 
    152155         /x) 
    153156       ) { 
    154       my ($whitespace, $statement, $module, $version) = ($1, $2, $3,$4); 
     157      my ($whitespace, $statement, $module, $version) = ($1, $2, $3, $4); 
    155158 
    156159      # we only consider require statements that are flush against 
    157160      # the left edge. any other require statements give too many 
     
    169172      # skip if the phrase was "use of" -- shows up in gimp-perl, et al. 
    170173      next if $module eq 'of'; 
    171174 
    172       # if the module ends in a comma we probaly caught some 
     175      # if the module ends in a comma we probably caught some 
    173176      # documentation of the form 'check stuff,\n do stuff, clean 
    174177      # stuff.' there are several of these in the perl distribution 
    175178 
     
    181184 
    182185      #      ($module =~ m/^\./) && next; 
    183186 
    184       # if the module ends with .pm strip it to leave only basename. 
    185       # starts with /, which means its an absolute path to a file 
     187      # if the module starts with /, it is an absolute path to a file 
    186188      if ($module =~ m(^/)) { 
    187189        print "$module\n"; 
    188190        next; 
     
    193195      $module =~ s/qw.*$//; 
    194196      $module =~ s/\(.*$//; 
    195197 
     198      # if the module ends with .pm, strip it to leave only basename. 
    196199      $module =~ s/\.pm$//; 
    197200 
    198201      # some perl programmers write 'require URI/URL;' when 
     
    211214 
    212215      my $ver = $1; 
    213216      if ($ver =~ /5.00/) { 
    214         print "perl >= 0:$ver\n"
     217        $perlreq{"0:$ver"} = 1
    215218        next; 
    216219      } 
    217220      else { 
    218         print "perl >= 1:$ver\n"
     221        $perlreq{"1:$ver"} = 1
    219222        next; 
    220223      } 
    221224 
     
    237240      ($module =~ m/\.ph$/) && next; 
    238241 
    239242      $require{$module} = $version; 
    240       $line{$module} = $_; 
    241243    } 
    242244 
    243245  }