… | |
… | |
5 | use Storable; |
5 | use Storable; |
6 | use Opcode; |
6 | use Opcode; |
7 | use Safe; |
7 | use Safe; |
8 | use Safe::Hole; |
8 | use Safe::Hole; |
9 | |
9 | |
|
|
10 | use YAML::Syck (); |
10 | use Time::HiRes; |
11 | use Time::HiRes; |
11 | use Event; |
12 | use Event; |
12 | $Event::Eval = 1; # no idea why this is required, but it is |
13 | $Event::Eval = 1; # no idea why this is required, but it is |
|
|
14 | |
|
|
15 | # work around bug in YAML::Syck - bad news for perl6, will it be as broken wrt. unicode? |
|
|
16 | $YAML::Syck::ImplicitUnicode = 1; |
13 | |
17 | |
14 | use strict; |
18 | use strict; |
15 | |
19 | |
16 | _init_vars; |
20 | _init_vars; |
17 | |
21 | |
… | |
… | |
1025 | } |
1029 | } |
1026 | |
1030 | |
1027 | ############################################################################# |
1031 | ############################################################################# |
1028 | # the server's main() |
1032 | # the server's main() |
1029 | |
1033 | |
|
|
1034 | sub cfg_load { |
|
|
1035 | open my $fh, "<:utf8", cf::confdir . "/config" |
|
|
1036 | or return; |
|
|
1037 | |
|
|
1038 | local $/; |
|
|
1039 | *CFG = YAML::Syck::Load <$fh>; |
|
|
1040 | |
|
|
1041 | use Data::Dumper; warn Dumper \%CFG; |
|
|
1042 | } |
|
|
1043 | |
1030 | sub main { |
1044 | sub main { |
|
|
1045 | cfg_load; |
1031 | db_load; |
1046 | db_load; |
1032 | load_extensions; |
1047 | load_extensions; |
1033 | Event::loop; |
1048 | Event::loop; |
1034 | } |
1049 | } |
1035 | |
1050 | |
… | |
… | |
1087 | |
1102 | |
1088 | # reload cf.pm |
1103 | # reload cf.pm |
1089 | $msg->("reloading cf.pm"); |
1104 | $msg->("reloading cf.pm"); |
1090 | require cf; |
1105 | require cf; |
1091 | |
1106 | |
1092 | # load database again |
1107 | # load config and database again |
|
|
1108 | cf::cfg_load; |
1093 | cf::db_load; |
1109 | cf::db_load; |
1094 | |
1110 | |
1095 | # load extensions |
1111 | # load extensions |
1096 | $msg->("load extensions"); |
1112 | $msg->("load extensions"); |
1097 | cf::load_extensions; |
1113 | cf::load_extensions; |