… | |
… | |
222 | |
222 | |
223 | =back |
223 | =back |
224 | |
224 | |
225 | =cut |
225 | =cut |
226 | |
226 | |
227 | BEGIN { |
227 | $Coro::State::WARNHOOK = sub { |
228 | *CORE::GLOBAL::warn = sub { |
|
|
229 | my $msg = join "", @_; |
228 | my $msg = join "", @_; |
230 | |
229 | |
231 | $msg .= "\n" |
230 | $msg .= "\n" |
232 | unless $msg =~ /\n$/; |
231 | unless $msg =~ /\n$/; |
233 | |
232 | |
234 | $msg =~ s/([\x00-\x08\x0b-\x1f])/sprintf "\\x%02x", ord $1/ge; |
233 | $msg =~ s/([\x00-\x08\x0b-\x1f])/sprintf "\\x%02x", ord $1/ge; |
235 | |
234 | |
236 | LOG llevError, $msg; |
235 | LOG llevError, $msg; |
237 | }; |
236 | }; |
238 | } |
|
|
239 | |
237 | |
240 | $Coro::State::DIEHOOK = sub { |
238 | $Coro::State::DIEHOOK = sub { |
241 | return unless $^S eq 0; # "eq", not "==" |
239 | return unless $^S eq 0; # "eq", not "==" |
|
|
240 | |
|
|
241 | warn Carp::longmess $_[0]; |
242 | |
242 | |
243 | if ($Coro::current == $Coro::main) {#d# |
243 | if ($Coro::current == $Coro::main) {#d# |
244 | warn "DIEHOOK called in main context, Coro bug?\n";#d# |
244 | warn "DIEHOOK called in main context, Coro bug?\n";#d# |
245 | return;#d# |
245 | return;#d# |
246 | }#d# |
246 | }#d# |
247 | |
247 | |
248 | # kill coroutine otherwise |
248 | # kill coroutine otherwise |
249 | warn Carp::longmess $_[0]; |
|
|
250 | Coro::terminate |
249 | Coro::terminate |
251 | }; |
250 | }; |
252 | |
|
|
253 | $SIG{__DIE__} = sub { }; #d#? |
|
|
254 | |
251 | |
255 | @safe::cf::global::ISA = @cf::global::ISA = 'cf::attachable'; |
252 | @safe::cf::global::ISA = @cf::global::ISA = 'cf::attachable'; |
256 | @safe::cf::object::ISA = @cf::object::ISA = 'cf::attachable'; |
253 | @safe::cf::object::ISA = @cf::object::ISA = 'cf::attachable'; |
257 | @safe::cf::player::ISA = @cf::player::ISA = 'cf::attachable'; |
254 | @safe::cf::player::ISA = @cf::player::ISA = 'cf::attachable'; |
258 | @safe::cf::client::ISA = @cf::client::ISA = 'cf::attachable'; |
255 | @safe::cf::client::ISA = @cf::client::ISA = 'cf::attachable'; |