yoda54 has asked for the wisdom of the Perl Monks concerning the following question:

Greetings Monks,

Any MUD authors have any advice? I'd like to take a stab at writing a MUD in Perl but first I need some help.

Q: Are there any better alternatives to using a HUGE dispatch table for the grundles of options you can do in a MUD?

Q: How can I define my own keyboard combination for sending signals to a script? I'd like to define <Ctrl-blah> to SIGUSR1.



Thanks Monks!

Replies are listed 'Best First'.
Re: Dispatch tables & Signals.
by ambrus (Abbot) on Aug 03, 2004 at 21:25 UTC
    How can I define my own keyboard combination for sending signals to a script? I'd like to define <Ctrl-blah> to SIGUSR1.

    No, but you can change the default key bindings from SIGINT=c-c, SIGQUIT=c-\, SIGTSTP=c-z. (To clarify, you can make c-k send a SIGINT instead of c-c, but you can't use a new signal like SIGUSR1.)

    However, you can use the three existing signals for whatever you wish. You can also switch off canon mode, process the keystrokes yourself, and emulate such a behaiviour. All you have to do is to kill 0, SIGUSR1(); when the user presses Ctrl-blah.

    Update: I forgot to say this: see info "(libc)Special Characters" for more info, if you have glibc.