ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/dm-support.ext
(Generate patch)

Comparing deliantra/server/ext/dm-support.ext (file contents):
Revision 1.1 by root, Fri Dec 15 19:29:18 2006 UTC vs.
Revision 1.3 by root, Fri Jan 12 01:29:23 2007 UTC

9 my ($fh) = @_; 9 my ($fh) = @_;
10 10
11 binmode $fh, ":raw:perlio:utf8"; 11 binmode $fh, ":raw:perlio:utf8";
12 12
13 my $buf; 13 my $buf;
14 my ($a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p, $q, $r, $s, $t, $u, $v, $w, $x, $y, $z);
14 my ($a,$b,$c,$d,%l,@l); # for use by shell users 15 my (%l, @l); # for use by shell users
15 16
16 print $fh "Welcome\n> "; 17 print $fh "Welcome!\n",
18 "Remember that everything entered here will be in the main coro context within cf::!\n",
19 "You can freely use \$a .. \$z and \@l and \%l\n";
20 print $fh "\n> ";
17 21
18 Event->io (fd => $fh, poll => 'r', data => cf::WF_AUTOCANCEL, cb => sub { 22 Event->io (fd => $fh, poll => 'r', data => 0, cb => sub {
19 if (defined (my $cmd = <$fh>)) { 23 if (defined (my $cmd = <$fh>)) {
20 my $old_fh = select $fh; 24 my $old_fh = select $fh;
21 25
22 if ($cmd =~ /^\s*exit\b/i) { 26 if ($cmd =~ /^\s*exit\b/i) {
23 print "will not exit() server.\n"; 27 print "will not exit() server.\n";
24 } else { 28 } else {
25 {
26 package cf; 29 package cf;
27 eval $cmd; 30 my @res = eval $cmd;
28 } 31 warn "tcpshell evaluation error: $@" if $@;
29 print $@ if $@; 32 print $@ if $@;
33
34 print cf::dumpval @res > 1 ? \@res : $res[0] if @res;
30 } 35 }
31 36
32 print "> "; 37 print "\n> ";
33 select $old_fh; 38 select $old_fh;
34 } else { 39 } else {
35 $_[0]->w->cancel; 40 $_[0]->w->cancel;
36 } 41 }
37 }); 42 });

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines