lilalo

view l3config.pm @ 28:450b6ac9b657

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