16.13. Listing Available SignalsProblemYou want to know the signals your operating system provides. SolutionIf your shell has a built-in kill -l command, use it: % kill -l
Or using just Perl, print the keys in % perl -e 'print join(" ", keys %SIG), "\n"' Before version 5.004, you had to use the Config module: % perl -MConfig -e 'print $Config{sig_name}' Discussion
If your version of Perl is before 5.004, you have to use
The following code retrieves by name and number the available signals from Perl's standard Config.pm module. Use 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++; } See AlsoThe documentation for the standard Config module, also in Chapter 7 of Programming Perl ; the "Signals" sections in Chapter 6 of Programming Perl and in perlipc (1) |
|