[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: First approximation of source line count for potato



Tuesday, May 02, 2000, 3:00:46 PM, Joey wrote:
>> So that 8.0 is 8,000, not 8.  Besides, how many scripts are floating around in
>> perl that don't end in .pl?  A /lot/.  File really is needed to be used.

> I would actually trust extention more than file here. Lots of perl
> modules, and even some perl scripts, do not start with a #!/usr/bin/perl
> shebang, and that's the only chance file has to detect perl code.

    Speaking of perl...

foreach $file (@files){
  if ($file =~ m/^.*\.(\w+)$/i){
    if ($extensions_short{$1}){
      count_some_code_boyeee($1);
    }
    else{
      $file_sez = `file $file`;
      if ($file_sez =~ m/^$file: (\w+)/i){
        if ($extensions_long{$1}){
           count_some_code_boyeee($extensions_long{$1});
        }
      }
    }
  }
}

    IE, we're not limited to file's internal logic.  We can short circuit a
little bit in the script that is running it.  The contents of
%extensions_short and $extensions_long will be left as an exercise to the
reader and no guarentee this code would remotely work since I just flung it
out there in the middle of BSing with a cow-orker.

-- 
         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
         ICQ: 5107343          | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------



Reply to: