Skip to content
Browse files

fix command line parsing in cpanstats-reparse

  • Loading branch information...
1 parent 2522f33 commit 677697ca80cfc241d39d9698282c45939ce03470 barbie committed Nov 18, 2008
Showing with 14 additions and 2 deletions.
  1. +2 −0 CHANGES
  2. +12 −2 bin/cpanstats-reparse
View
2 CHANGES
@@ -4,6 +4,8 @@ Revision history for Perl module CPAN::WWW::Testers::Generator.
- added epoch to date extraction from article.
- added filename reference from CPAN-DistnameInfo.
- added ability to provide SQL string in bin/cpanstats-select (v0.09).
+ - added better command line option parsing to bin/cpanstats-reparse
+ (v0.08).
0.30 01/10/2008
- ensure upload pattern matching is for the end of the string.
View
14 bin/cpanstats-reparse
@@ -2,7 +2,7 @@
use strict;
$|++;
-my $VERSION = '0.07';
+my $VERSION = '0.08';
#----------------------------------------------------------------------------
@@ -101,7 +101,7 @@ sub get_list {
while(<$fh>) {
chomp;
my ($num) = (m/^(\d+)/);
- push @list, $num;
+ push @list, $num if($num);
}
$fh->close;
return @list;
@@ -127,6 +127,16 @@ sub init_options {
_help(1) if($options{help});
_help(0) if($options{version});
+
+ unless($options{directory} && -d $options{directory}) {
+ print "Source directory not found [$options{directory}]\n\n";
+ _help(1);
+ }
+
+ unless($options{id} || -f $options{file}) {
+ print "Must specify an ID or FILE to reparse\n\n";
+ _help(1);
+ }
}
sub _help {

0 comments on commit 677697c

Please sign in to comment.
Something went wrong with that request. Please try again.