ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/eval.ext
Revision: 1.3
Committed: Thu Apr 29 07:59:17 2010 UTC (14 years ago) by root
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +0 -0 lines
State: FILE REMOVED
Log Message:
no sync_job error at startup

File Contents

# User Rev Content
1 root 1.1 #! perl
2     #CONVERSION: BROKEN, MISSING ON_APPLY
3    
4     # generic perl code evaluator
5    
6     sub eval_event {
7     my ($event, %vars) = @_;
8    
9     my $code = $event->message;
10     my $who = eval { $event->environment->name } || "<unknown>";
11    
12     my $rv = cf::safe_eval $code, %vars;
13    
14 root 1.2 cf::error $@ if $@;
15 root 1.1
16     $rv
17     }
18    
19     sub on_say {
20     my ($event, $ob, $who, $msg) = @_;
21    
22     local $_ = $msg;
23    
24     eval_event $event, ob => $ob, who => $who, msg => $msg
25     }
26    
27     sub on_apply {
28     my ($event, $ob, $who) = @_;
29    
30     eval_event $event, ob => $ob, who => $who
31     }