… | |
… | |
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 | |
… | |
… | |
108 | $JSON::Syck::ImplicitUnicode = 0; # work around JSON::Syck bugs |
112 | $JSON::Syck::ImplicitUnicode = 0; # work around JSON::Syck bugs |
109 | JSON::Syck::Dump $_[0] |
113 | JSON::Syck::Dump $_[0] |
110 | } |
114 | } |
111 | |
115 | |
112 | =back |
116 | =back |
|
|
117 | |
|
|
118 | =cut |
113 | |
119 | |
114 | ############################################################################# |
120 | ############################################################################# |
115 | |
121 | |
116 | =head2 EVENTS AND OBJECT ATTACHMENTS |
122 | =head2 EVENTS AND OBJECT ATTACHMENTS |
117 | |
123 | |
… | |
… | |
420 | This API is preliminary (most likely, the EVENT_KLASS_xxx prefix will be |
426 | This API is preliminary (most likely, the EVENT_KLASS_xxx prefix will be |
421 | removed in future versions), and there is no public API to access override |
427 | removed in future versions), and there is no public API to access override |
422 | results (if you must, access C<@cf::invoke_results> directly). |
428 | results (if you must, access C<@cf::invoke_results> directly). |
423 | |
429 | |
424 | =back |
430 | =back |
|
|
431 | |
|
|
432 | =cut |
425 | |
433 | |
426 | ############################################################################# |
434 | ############################################################################# |
427 | |
435 | |
428 | =head2 METHODS VALID FOR ALL CORE OBJECTS |
436 | =head2 METHODS VALID FOR ALL CORE OBJECTS |
429 | |
437 | |
… | |
… | |
912 | *{"safe::$fun"} = $safe_hole->wrap ($cb); |
920 | *{"safe::$fun"} = $safe_hole->wrap ($cb); |
913 | } |
921 | } |
914 | |
922 | |
915 | =back |
923 | =back |
916 | |
924 | |
|
|
925 | =cut |
|
|
926 | |
917 | ############################################################################# |
927 | ############################################################################# |
918 | |
928 | |
919 | =head2 EXTENSION DATABASE SUPPORT |
929 | =head2 EXTENSION DATABASE SUPPORT |
920 | |
930 | |
921 | Crossfire maintains a very simple database for extension use. It can |
931 | Crossfire maintains a very simple database for extension use. It can |
… | |
… | |
1019 | } |
1029 | } |
1020 | |
1030 | |
1021 | ############################################################################# |
1031 | ############################################################################# |
1022 | # the server's main() |
1032 | # the server's main() |
1023 | |
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 | |
1024 | sub main { |
1042 | sub main { |
|
|
1043 | cfg_load; |
1025 | db_load; |
1044 | db_load; |
1026 | load_extensions; |
1045 | load_extensions; |
1027 | Event::loop; |
1046 | Event::loop; |
1028 | } |
1047 | } |
1029 | |
1048 | |
… | |
… | |
1081 | |
1100 | |
1082 | # reload cf.pm |
1101 | # reload cf.pm |
1083 | $msg->("reloading cf.pm"); |
1102 | $msg->("reloading cf.pm"); |
1084 | require cf; |
1103 | require cf; |
1085 | |
1104 | |
1086 | # load database again |
1105 | # load config and database again |
|
|
1106 | cf::cfg_load; |
1087 | cf::db_load; |
1107 | cf::db_load; |
1088 | |
1108 | |
1089 | # load extensions |
1109 | # load extensions |
1090 | $msg->("load extensions"); |
1110 | $msg->("load extensions"); |
1091 | cf::load_extensions; |
1111 | cf::load_extensions; |