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.5 by root, Wed Apr 18 14:24:09 2007 UTC vs.
Revision 1.11 by root, Thu Sep 20 12:30:28 2007 UTC

1#! perl 1#! perl
2 2
3use Coro::Debug;
3use IO::Socket; 4use IO::Socket;
4use Storable qw/nfreeze thaw/; 5use Storable qw/nfreeze thaw/;
5 6
6my %global; # for use by eval'ed commands 7my %global; # for use by eval'ed commands
7 8
22You can freely use \$a .. \$z and \@l and \%l 23You can freely use \$a .. \$z and \@l and \%l
23 24
24Useful commands (note the '&'): 25Useful commands (note the '&'):
25 26
26reload_perl & 27reload_perl &
28reload_config &
27reload_regions & 29reload_regions &
28reload_facedata & 30reload_facedata &
29reload_treasures & 31reload_treasures &
30reload_archetypes & 32reload_archetypes &
33ext::help::reload &
34ext::books::reload &
35ext::map_tags::reload &
31ext::map_world::reload & 36ext::map_world::reload &
32EOF 37EOF
33 print "\n> "; 38 print "\n> ";
34 39
35 Event->io (fd => $fh, poll => 'r', data => 0, cb => sub { 40 Event->io (fd => $fh, poll => 'r', data => 0, cb => sub {
36 if (defined (my $cmd = <$fh>)) { 41 if (defined (my $cmd = <$fh>)) {
37 $cmd =~ s/\s+$//; 42 $cmd =~ s/\s+$//;
38 43
39 if ($cmd =~ /^\s*exit\b/i) { 44 if ($cmd =~ /^\s*exit\b/i) {
40 print "will not exit() server.\n"; 45 print "will not exit() server.\n";
46 } elsif ($cmd =~ s/^coro\s+// or $cmd =~ /^(?:ps|bt\s)/) {
47 Coro::Debug::command $cmd;
41 } else { 48 } else {
42 my $sub = sub { 49 my $sub = sub {
43 package cf; 50 package cf;
44 select $fh; 51 select $fh;
45 52
58 print "result:\n", cf::dumpval @res > 1 ? \@res : $res[0] if @res; 65 print "result:\n", cf::dumpval @res > 1 ? \@res : $res[0] if @res;
59 print "\n> "; 66 print "\n> ";
60 }; 67 };
61 68
62 if ($cmd =~ s/\s*&$//) { 69 if ($cmd =~ s/\s*&$//) {
63 Coro::async_pool { $sub->() }; 70 cf::async {
71 $Coro::current->desc ($cmd);
72 $sub->()
73 };
64 } else { 74 } else {
65 $sub->(); 75 $sub->();
66 } 76 }
67 } 77 }
68 78
77if ($cf::CFG{perl_shell}) { 87if ($cf::CFG{perl_shell}) {
78 if (my $listen = new IO::Socket::INET LocalAddr => $cf::CFG{perl_shell}, Listen => 1, ReuseAddr => 1) { 88 if (my $listen = new IO::Socket::INET LocalAddr => $cf::CFG{perl_shell}, Listen => 1, ReuseAddr => 1) {
79 Event->io (fd => $listen, poll => 'r', data => cf::WF_AUTOCANCEL, cb => sub { tcp_serve $listen->accept }); 89 Event->io (fd => $listen, poll => 'r', data => cf::WF_AUTOCANCEL, cb => sub { tcp_serve $listen->accept });
80 } 90 }
81} 91}
92
93

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines