Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Piatok, 29. marec 2024

Súbor: [Platon] / iotta / iotta.pl (stiahnutie)

Revízia 1.2, Sun Mar 23 11:29:52 2003 UTC (21 years ago) by yenar

Zmeny od 1.1: +21 -18 [lines]

disable list-based module loading [iotta.pl]

#!/usr/bin/perl
require Iotta::Ctrl;
use strict;

my (%cfg);

#sub init_mods {
#    my ($mods, $pre, $fname);
#
#    $fname = $cfg{"init/mods"};
#    $fname = "iotta.mods" unless $fname;
#
#    open (INPUT, $fname) || return 1;
#    while (<INPUT>) { $mods.=$_; }
#    close (INPUT);
#
#    for (split (/\n/, $mods)) {
#        my $b = $_;
#        s/::/\//g;
#        print STDERR "loading $b ($_.pm)\n";
#        require "$_.pm" unless /^[ \t]*#.*$/;
#    }
#}

sub init_conf {
    my ($conf, $key, $val, $fname);

    $fname = shift;
    $fname = "iotta.cf" unless $fname;
    print STDERR "loading configuration file $fname...\n";

    open (CF, $fname) || die "couldn't open configuration file $fname\n";
    while (<CF>) { $conf .= $_; };
    close CF;

    $conf =~ s/^#.*//;

    for (split (/\n/, $conf)) {
        ($key,$val) = split (/=/, $_);
        $cfg{$key}=$val;
    }
}

sub start_control {
    my ($ctrl, $ctrln, $retval);
    $ctrln = $cfg{"ctrl"};
    $ctrln = "Iotta::Ctrl" if (!$ctrln);
    print STDERR "starting control module: $ctrln...\n";
    my $req = $ctrln;
    $req =~ s/::/\//g;
    require "$req.pm";
    $ctrl = $ctrln->new;
    $ctrl->config(\%cfg);
    $retval = $ctrl->main;
    exit ($retval);
}

&init_conf (@ARGV);

#&init_mods ();

&start_control ();

exit (0);

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok