CPAN-Testers-Data-Generator
view release on metacpan or search on metacpan
examples/build-pass-reports.pl view on Meta::CPAN
my $cfg = Config::IniFiles->new( -file => $options{config} );
# configure databases
my $dbx;
my $db = 'CPANSTATS';
die "No configuration for $db database\n" unless($cfg->SectionExists($db));
my %opts = map {$_ => ($cfg->val($db,$_)||undef);} qw(driver database dbfile dbhost dbport dbuser dbpass);
$opts{AutoCommit} = 0;
$dbx = CPAN::Testers::Common::DBUtils->new(%opts);
die "Cannot configure $db database\n" unless($dbx);
$dbx->{'mysql_enable_utf8'} = 1 if($opts{driver} =~ /mysql/i);
$dbx->{'mysql_auto_reconnect'} = 1 if($opts{driver} =~ /mysql/i);
my @max = $dbx->get_query('hash','SELECT max(id) as max, count(*) as total FROM cpanstats');
my $max = $max[0]->{max};
my $total = $max[0]->{total};
$options{to} ||= $max;
print "max = $max, total = $total\n";
lib/CPAN/Testers/Data/Generator.pm view on Meta::CPAN
# load configuration
my $cfg = Config::IniFiles->new( -file => $hash{config} );
# configure databases
for my $db (qw(CPANSTATS METABASE)) {
die "No configuration for $db database\n" unless($cfg->SectionExists($db));
my %opts = map {$_ => ($cfg->val($db,$_)||undef);} qw(driver database dbfile dbhost dbport dbuser dbpass);
$opts{AutoCommit} = 0;
$self->{$db} = CPAN::Testers::Common::DBUtils->new(%opts);
die "Cannot configure $db database\n" unless($self->{$db});
$self->{$db}->{'mysql_enable_utf8'} = 1 if($opts{driver} =~ /mysql/i);
$self->{$db}->{'mysql_auto_reconnect'} = 1 if($opts{driver} =~ /mysql/i);
}
if($cfg->SectionExists('ADMINISTRATION')) {
my @admins = $cfg->val('ADMINISTRATION','admins');
$self->{admins} = \@admins;
}
# command line swtiches override configuration settings
for my $key (qw(logfile poll_limit stopfile offset aws_bucket aws_namespace)) {
( run in 0.264 second using v1.01-cache-2.11-cpan-00829025b61 )