ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cf.schmorp.de/maps/perl/eval.ext
Revision: 1.8
Committed: Fri Dec 15 19:11:46 2006 UTC (17 years, 7 months ago) by root
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +0 -0 lines
State: FILE REMOVED
Log Message:
move .ext to server

File Contents

# Content
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 warn $@ if $@;
15
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 }