#!/usr/bin/perl

###########################
### Autor: Sebastian Enger / B.Sc. 
### Copyright: Sebastian Enger
### Licence: Commercial
### Version: 1.1.1  - 2013-09-18
### Contact: sebastian.enger@gmail.com
###########################

package Crawler::Config;
### http://search.cpan.org/~sherzodr/Config-Simple-4.59/Simple.pm

use strict;
use Config::Simple;
use File::Path;

my $ScannedFile = "/home/thecerial/trendcrawler/logfile/alreadyscanned.txt";
my $CookieFile = "/home/thecerial/trendcrawler/logfile/cookies.txt";

 
# Konstruktor
sub new {

	my ($class) = @_;
	
	my $cfgFile;
	if ($class !~ /\w{3,}/ig){
		$cfgFile = "/home/thecerial/trendcrawler/trendcrawler.cfg";
	}

	my $cfg = Config::Simple->new(filename=>$cfgFile);
	#%Config = $cfg->vars();
	
	my $self = {
		'config' => $cfg,
	#	'dispo' => $inDispo
	};
	bless $self, $class;
	make_path '/home/thecerial/trendcrawler/logfile/', {owner=>'thecerial', group=>'users'};

	return $self;
  
}

sub read() {
	
	my $self 	= shift;
	my $key		= shift;
	
	my $cfg 	= $self->{config};
	my $isRead 	= $cfg->param(-block=>$key);

	return $isRead;
}