The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!/usr/bin/perl
use strict;
use base 'LEOCHARRE::CLI';
use vars qw($VERSION);
$VERSION = sprintf "%d.%02d", q$Revision: 1.4 $ =~ /(\d+)/g;
   
my $o= gopts();

sub usage {
   return qq{
$0 - create MANIFEST file

   -h help
   -d debut
   -v version
   -d debug on, shows what's grepped out

Will grep out .swp files, CVS, .gz, .dev.

USAGE EXAMPLES

   $0 > MANIFEST

   }; 
}

my $abs_d= $ARGV[0];
$abs_d ||= './';

-d $abs_d
   or warn ("$abs_d is not dir")
   and exit;

is_pmdist($abs_d) or exit;


sub include_file {
   my $file = shift;

   my $ok = 1;
   
   if ( $file=~/\/CVS|\.gz$|.swp$|\bdev\b/ ){
      $ok = 0;
   }
   if (DEBUG){
      print STDERR ($ok ? '' : '  no: ')."$file\n";
   }
   return $ok;
}


my @files = map { s/^\.\///; $_ } sort grep { include_file($_) } split( /\n/, `find '$abs_d' -type f`);

for my $line (@files){
   $line=~/\s/ and $line="'$line'";
   print "$line\n";
}


sub is_pmdist {
   my $d = shift;
   -d $d
      or warn("$d is not dir")
      and return;

   -f "$d/Makefile.PL"
      or warn("$d is not dist, no Makefile.PL")
      and return 0;

   return 1;
}