21 my @opt = <<'=back' =~ /B<--(\S+)>/g;
31 This script is intended to be run once a day. It is a wrapper around
32 refill-cpanstatsdb-minutes.pl which finds missing reports in the
39 use lib
"$FindBin::Bin/../lib";
45 use File
::Basename
qw(dirname);
46 use File
::Path
qw(mkpath);
50 use Hash
::Util
qw(lock_keys);
53 lock_keys
%Opt, map { /([^=]+)/ } @opt;
58 use File
::Basename
();
62 my($root) = "$ENV{HOME}/var/metabase-log/missings";
63 my($refillroot) = "$ENV{HOME}/var/refill-cpanstatsdb";
64 my($prg) = "$ENV{HOME}/src/andk-cpan-tools/bin/refill-cpanstatsdb-minutes.pl";
66 my $dt = DateTime
->new( time_zone
=> 'UTC', year
=> 2012, month
=> 10, day
=> 8);
67 my $dtmax = DateTime
->now( time_zone
=> 'UTC' );
68 $dtmax->subtract(days
=> 3);
70 my $path = sprintf "%s/%s/%s.rpt", $root, $dt->year, $dt->ymd;
72 File
::Path
::mkpath File
::Basename
::dirname
$path;
73 my $pickdate = $dt->ymd("");
74 my $refillpath = sprintf "%s/%s/%s", $refillroot, $dt->year, $dt->month;
75 my $command = sprintf "%s %s --pickdate=%s --collectguids %s > %s 2> %s.err", $^X
, $prg, $pickdate, $refillpath, $path, $path;
76 warn "RUNNING $command\n";
77 0 == system $command or die;
79 unlink $_ unless -s
$_;
82 $dt->add( days
=> 1 );
88 # cperl-indent-level: 4