vanstyn / RapidApp

Turnkey ajaxy webapps
http://rapi.io
Other
48 stars 15 forks source link

Make sure all packages are in their own *.pm file #110

Closed vanstyn closed 9 years ago

vanstyn commented 9 years ago

I was able to identify all remaining offenders with this script/snippet:

#!/usr/bin/perl

use strict;
use warnings;

use Path::Class qw( file dir );

my $fHash = {};
dir( $ARGV[0] )->recurse(
  preorder => 1,
  depthfirst => 1,
  callback => sub {
    my $File = shift;
    if (-f $File) {
      my $count = 0;
      for my $line(split(/\r?\n/,$File->slurp)) {
        $count++ if ($line =~ /^package\s+/);
      }

      print "$File\n" if ($count > 1);
    }
  }
);

Running on the lib/ dir produced this list of files with more than one package declaration:

lib/RapidApp/Responder.pm
lib/RapidApp/Spreadsheet/ExcelTableReader.pm
lib/RapidApp/Spreadsheet/ExcelTableWriter.pm
lib/RapidApp/Spreadsheet/ParseExcelExt.pm
lib/Catalyst/Helper/Model/DBIC/Schema/ForRapidDbic.pm
vanstyn commented 9 years ago

Responder and ForRapidDbic or POD hits, and ParseExcelExt overrides Spreadsheet::ParseExcel::Worksheet which will need to be looked into later...