lilalo

annotate l3config.pm @ 29:b3f5f5560802

l3-cgi: Найти курс по PATH_INFO
HISTORY: Описаны изменения в версии v_0_2_4
l3-frontend: В секции "О программе" убрал разрыв строки
author devi
date Mon Nov 07 13:28:15 2005 +0200 (2005-11-07)
parents 098664cf339c
children f5f07049bd4f
rev   line source
devi@23 1 package l3config;
devi@23 2
devi@23 3 use Exporter;
devi@23 4 use Getopt::Long;
devi@23 5
devi@23 6 @ISA = ('Exporter');
devi@23 7 @EXPORT = qw(%Config &init_config);
devi@23 8
devi@23 9 our $Config_File = "labmaker.conf";
devi@23 10 our %Config = (
devi@23 11 "skip_empty" => "yes",
devi@23 12 "skip_interrupted" => "no",
devi@23 13 "skip_wrong" => "no",
devi@28 14 "editors" => ["vi", "pico", "ee", "vim", "nano"],
devi@23 15 "pagers" => ["more", "less", "zmore", "zless", "info",
devi@23 16 "man", "mc", "trafshow", "screen", "cfdisk",
devi@23 17 "trafshow-bsd", "yes", "lynx", "links", "centericq"
devi@23 18 ],
devi@23 19 "terminal" => ["mc"],
devi@23 20 "suppress_editors" => "yes",
devi@23 21 "suppress_pagers" => "yes",
devi@23 22 "suppress_terminal" => "yes",
devi@23 23
devi@23 24 "terminal_width" => 100,
devi@23 25 "terminal_height" => 100,
devi@23 26 "verbose" => "yes",
devi@23 27
devi@23 28 "head_lines" => 5,
devi@23 29 "tail_lines" => 5,
devi@23 30 "cache_head_lines" => 5,
devi@23 31 "cache_tail_lines" => 5,
devi@23 32 "skip_text" => "...",
devi@23 33 "show_time" => "yes",
devi@23 34 "show_diffs" => "yes",
devi@23 35 "show_comments" => "yes",
devi@23 36
devi@23 37 "input" => "/root/.labmaker",
devi@23 38 "diffs" => "",
devi@23 39 "input_mask" => "*.script",
devi@23 40 "encoding" => "utf-8",
devi@23 41
devi@23 42 "cache" => "/tmp/report.xml",
devi@25 43 "cache_stat" => "/tmp/.report.dat",
devi@23 44
devi@23 45 "output" => "/tmp/report.html",
devi@23 46 #"output" => "report.xml",
devi@23 47 "output_mask" => "INDEX",
devi@23 48 "output_format" => "html",
devi@27 49 "frontend_css" => "/l3/l3.css",
devi@27 50 "frontend_google_ico" => "/l3/google.ico",
devi@27 51 "frontend_linux_ico" => "/l3/linux.ico",
devi@27 52 "frontend_freebsd_ico" => "/l3/freebsd.ico",
devi@27 53 "frontend_opennet_ico" => "/l3/opennet.ico",
devi@27 54 "frontend_local_ico" => "/l3/freebsd.ico",
devi@23 55
devi@23 56 "signature" => "#lm:",
devi@23 57 "from" => "",
devi@23 58 "to" => "",
devi@23 59 "lab" => "",
devi@23 60 "keywords" => "linux command",
devi@23 61 "files_keywords" => "linux file",
devi@23 62
devi@23 63 comment_width => "300",
devi@23 64 time_width => "60",
devi@25 65
devi@25 66 "mode" => "daemon", # daemon | normal
devi@25 67 "daemon_sleep_interval" => "1",
devi@25 68 "detach" => "yes",
devi@25 69 "agent_pidfile" => "$ENV{HOME}/.labmaker/l3-agent.pid",
devi@23 70
devi@27 71 "backend_address" => "127.0.0.1",
devi@27 72 "backend_port" => "18030",
devi@27 73 "backend_pidfile" => "/tmp/l3-backend.pid",
devi@27 74 "backend_datafile" => "/tmp/backend.xml",
devi@27 75
devi@25 76 "l3-agent" => "l3-agent",
devi@27 77 "l3-backend" => "l3-backend",
devi@25 78
devi@23 79 "course-name" => "",
devi@23 80 "course-code" => "",
devi@23 81 "course-date" => "",
devi@23 82 "course-center" => "",
devi@23 83 "course-trainer" => "",
devi@23 84 "course-student" => "",
devi@23 85 );
devi@23 86
devi@23 87 sub read_config_file
devi@23 88 {
devi@23 89 my $config = $_[0];
devi@23 90 my $filename = $_[1];
devi@23 91 open(CONFIG, "$filename")
devi@23 92 or return;
devi@23 93 while (<CONFIG>) {
devi@23 94 s/#.*//;
devi@23 95 next if /^\s*$/;
devi@23 96 my ($var, $val) = split /\s*=\s*/, $_, 2;
devi@23 97 $var =~ s/\s*//;
devi@23 98 $config->{$var} = $val;
devi@23 99 }
devi@23 100 close(CONFIG);
devi@23 101 }
devi@23 102
devi@23 103
devi@23 104 sub init_config
devi@23 105 {
devi@23 106 my %argv_config;
devi@23 107 my %file_config;
devi@23 108 read_config_file(\%file_config, $Config_File);
devi@23 109 GetOptions(\%argv_config, map "$_=s", keys %Config);
devi@23 110 %Config = (%Config, %file_config, %argv_config);
devi@23 111 }
devi@23 112