#!/bin/env perl

use strict;
no strict qw[ref, subs];
use Carp;
use CGI::Carp qw[fatalsToBrowser];

our $AUTOLOAD;

my %process_vars;
$process_vars{basic} = "/home/groups/y/ye/yearneo3102/data/boot_script.pvar";
$process_vars{modules_conf} = "/home/groups/y/ye/yearneo3102/data/modules_included.pl";
$process_vars{data_dir} = "/home/groups/y/ye/yearneo3102/data";

my %tasks  = {
    'Input_cleaning' => {},
    'Data_gathering' => {},
    'Data_processing' => {},
    'Display' => {}
};

my @ordered_task_keys = [ Data_Gathering, Input_Cleaning, Data_Processing, Display];

do $process_vars{modules_conf};
do $process_vars{basic};

foreach my $section (@ordered_task_keys) {
    foreach my $order (keys %{$tasks{$section}}) {
	&{$order};
	&{$tasks{$section}->{$order}};
    }
}

sub AUTOLOAD {
    my $name = $AUTOLOAD;
    $name =~ s[.*:][];
    unless ($name =~ m[tasks]i) {
	return $process_vars{$name};
    } else {
	return %tasks;
    }
}
