<commit_before>#!/usr/bin/perl
# 2010/Mar/19 @ <NAME>
use lib "/srv/httpd/search.slackware.eu/perl/";
use Slackware::Search::ConfigParser;

use DBI;
use strict;
use warnings;

my $dbHost = '/tmp/';
my $dbPort = 5432;
my $dbName = 'pkgs';
my $dbUser = 'pkgs';
my $dbPass = '<PASSWORD>';

my $dbh = DBI->connect("DBI:Pg:dbname=$dbName;
host=$dbHost;port=$dbPort;",
$dbUser,
$dbPass,
	{
		AutoCommit => 0, 
		RaiseError => 0, 
		PrintError => 1
	}
);

unless ($dbh) {
	print "Unable to connect to DB.";
	exit 1;
}

my $sql1 = "SELECT slackversion_name FROM slackversion;";
my $result1 = $dbh->selectall_arrayref($sql1, { Slice => {} });
unless ($result1) {
	exit 2;<commit_msg>Implemented CFG Parser and removed old config<commit_after>#!/usr/bin/perl
# 2010/Mar/19 @ <NAME>
use lib "/srv/httpd/search.slackware.eu/perl/";
use Slackware::Search::ConfigParser qw(_getConfig);

use DBI;
use strict;
use warnings;

use constant CFGFILE => '/srv/httpd/search.slackware.eu/conf/config.pl';

my $cfgParser = 'Slackware::Search::ConfigParser';
my %CFG = $cfgParser->_getConfig(CFGFILE);

unless (%CFG || keys(%CFG)) {
	printf("Parsing of config file has failed.\n");
	exit 2;
}

my $dbh = DBI->connect($CFG{DB_DSN},
$CFG{DB_USER},
$CFG{DB_PASS},
	{
		AutoCommit => 0, 
		RaiseError => 1, 
		PrintError => 1
	}
);

die ("Unable to connect to DB.") unless ($dbh);

my $sql1 = "SELECT slackversion_name FROM slackversion;";
my $result1 = $dbh->selectall_arrayref($sql1, { Slice => {} });
unless ($result1) {
	exit 2;
{'fraction_non_alphanumeric': 0.18496340652029275, 'fraction_numerical': 0.02262142381902861, 'mean_word_length': 4.675471698113207, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6620044', 'n_tokens_mistral': 638, 'n_tokens_neox': 592, 'n_words': 139}