home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Perl CookbookPerl CookbookSearch this book

16.13. Listing Available Signals

16.13.3. Discussion

If your version of Perl is before 5.004, you have to use signame and signo in Config to find the list of available signals, since keys %SIG wasn't implemented then.

The following code retrieves by name and number the available signals from Perl's standard Config.pm module. Use @signame indexed by number to get the signal name, and %signo indexed by name to get the signal number.

use Config;
defined $Config{sig_name} or die "No sigs?";
$i = 0;                     # Config prepends fake 0 signal called "ZERO".
foreach $name (split(' ', $Config{sig_name})) {
    $signo{$name} = $i;
    $signame[$i] = $name;
    $i++;
}

16.13.4. See Also

The documentation for the standard Config module, also in Chapter 32 of Programming Perl; the "Signals" sections in Chapter 16 of Programming Perl and in perlipc(1)



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.