| Leif Ericksen 2006-01-10, 4:02 am |
| This is the person that gave me the direction I needed to get my signals
working.. (Sorry for the top post here... I wanted the most important
part out first..)
For the actual FULL code that I am working with at present see the
bottom of the message.
On Sat, 2006-01-07 at 01:14 +0100, John Doe wrote:
> Leif Ericksen am Samstag, 7. Januar 2006 00.12:
>
> perldoc perlipc states:
>
> "Another interesting signal to send is signal number zero.
> This doesn't actually affect a child process, but instead
> checks whether it's alive or has changed its UID."
>
> I'm not a signal guru, but I think you can't assign a handler to the ZERO
> signal. I also got a segfault.
>
> Look at the following code, modified from yours.
>
> BTW, your chances for answers are bigger if you provide code that can be run
> by list members.
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> use Config;
>
> my $i = 0;
> my (@signames, %signos);
>
> defined $Config{sig_name}
> or
> die "The Stupid System does not support Signals?";
>
> sub sigcat {print "sigcat called"; exit;};
>
> foreach my $name (split(' ', $Config{sig_name})) {
> next if $name eq 'ZERO';
> $signos{$name} = $i;
> $signames[$i] = $name;
> print "$name:$i \t => SIG{$name} = \&sigcat\n";
> $SIG{$name}=\&sigcat;
> $i++;
> }
>
> {} while 1;
>
>
>
> hth joe
>
Changing the variable name signame to signames, seemed to be the big key
in making things work better... Also to avoid the 0 issue we should be
able to start our counter at 1. Now I know that I have more CASE
variables than may be require, but I am messing around with this to have
some fun and work on some projects that are both personal and business
in nature. I think the big thing is that signame must be in the Config
and it did not like being used as I was trying to use it. Thanks to the
two Gents that offered help! I will be back if I have additional
questions as I grow this program.
#!/usr/bin/perl
use strict;
use warnings;
use Config;
my $i = 0;
my (@signames, %signos);
defined $Config{sig_name}
or
die "The Stupid System does not support Signals?";
sub sigcat {print "sigcat called"; exit;};
foreach my $name (split(' ', $Config{sig_name})) {
next if $name eq 'ZERO';
$signos{$name} = $i;
$signames[$i] = $name;
print "$name:$i \t => SIG{$name} = \&sigcat\n";
$SIG{$name}=\&sigcat;
$i++;
}
{} while 1;
--
Leif Ericksen <leife@dls.net>
|