ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/maps/perl/dm-support.ext
Revision: 1.3
Committed: Fri Jul 21 10:47:02 2006 UTC (17 years, 10 months ago) by root
Branch: MAIN
Changes since 1.2: +2 -4 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 #! perl
2
3 use Storable qw/nfreeze thaw/;
4
5 my %global; # for use by eval'ed commands
6
7 cf::register_extcmd perl_eval => sub {
8 my ($pl, $data) = @_;
9
10 my ($token, $data) = split / /, $data, 2;
11
12 unless ($pl->ob->flag (cf::FLAG_WIZ)) {
13 $pl->send ("ext $token error permission denied");
14 return;
15 }
16
17 my ($code, $arg) = split /\0/, $data, 2;
18
19 $arg = eval { thaw $arg };
20 my @res = eval $code;
21
22 $@ ? $pl->send ("ext $token error $@")
23 : $pl->send ("ext $token ok " . nfreeze \@res);
24 };