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

I am new to perl and am working on a short little script that needs to catch a SIGINT signal.
I am working on a small embedded linux system with busybox.

Here is a brief snippet of how I setup my signal handler:
$SIG{INT} = \&intHandler; + ... + sub intHandler { ... }

When I run the script I get the following message (but it continues to run the rest of the script:
$ ./wdminterface.pl No such signal: SIGINT at ./wdminterface.pl line 40 (#1) (W signal) You specified a signal name as a subscript to %SIG that + was not recognized. Say kill -l in your shell to see the valid signal names on your sy +stem. $
Running kill -l confirms that I have that signal:
$ kill -l 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR +2 13) SIGPIPE 14) SIGALRM 15) SIGTERM 16) SIGSTK +FLT 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTS +TP 21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCP +U 25) SIGXFSZ 26) SIGVTALRM 27) SIGPROF 28) SIGWIN +CH 29) SIGIO 30) SIGPWR 31) SIGSYS $
I'm I missing something simple here? I can't figure out why it won't find the signal. Is this a problem with my perl code, perl setup or linux setup?

Replies are listed 'Best First'.
Re: No such signal: SIGINT, In embedded linux system
by sauoq (Abbot) on Dec 15, 2004 at 18:19 UTC

    I guess the first thing I'd do is check to see what signals perl thinks exist with perl -le 'print for keys %SIG'

    -sauoq
    "My two cents aren't worth a dime.";
    
      Good call, I get nothing back. What does that say about the setup?
      $ perl -le 'print for keys %SIG' $
        What does that say about the setup?

        It's... uh... broken. At least insofar as signals are concerned. :-)

        I think signal names are all compiled in when perl is built... so my best guess is that some headers were missing or broken and perl needs to be recompiled. Don't take my word as last on that though. Maybe there is an easier way to fix it.

        What version?

        -sauoq
        "My two cents aren't worth a dime.";