[comp.lang.perl] Signal handling in Perl

billy@vaxb.acs.unt.edu (04/15/91)

Hi,

I'm having a problem with signals in Perl.  In my program, I've put statements
like:

  $sig{'INT'}='IGNORE';

However, it seems that it has no effect (i.e. I can still interrupt the
program).  I've also tried setting up a signal handler and when the interrupt
occurs, the signal handler is never called.  Anybody have any ideas what I'm
doing wrong?

Thanks,

================================================================================
Billy Barron                  Bitnet : BILLY@UNTVAX
VAX/Unix Systems Manager      THENET : NTVAX::BILLY
University of North Texas   Internet : billy@vaxb.acs.unt.edu
                                SPAN : UTSPAN::UTADNX::NTVAX::BILLY
================================================================================

tchrist@convex.COM (Tom Christiansen) (04/16/91)

From the keyboard of billy@vaxb.acs.unt.edu:
:I'm having a problem with signals in Perl.  In my program, I've put statements
:like:
:
:  $sig{'INT'}='IGNORE';
:
:However, it seems that it has no effect (i.e. I can still interrupt the
:program).  I've also tried setting up a signal handler and when the interrupt
:occurs, the signal handler is never called.  Anybody have any ideas what I'm
:doing wrong?

You should be using %SIG not %sig for this.  Case counts.

--tom

rbj@uunet.UU.NET (Root Boy Jim) (04/16/91)

In article <1991Apr15.211051.3326@convex.com> tchrist@convex.COM (Tom Christiansen) writes:
>From the keyboard of billy@vaxb.acs.unt.edu:
>:
>:  $sig{'INT'}='IGNORE';
>:
>You should be using %SIG not %sig for this.  Case counts.
>
>--tom

How about `*sig = *SIG'? [GROAN]

Unfortunately, it doesn't quite work.

The right variable gets set, but the signal handler never does.

It's not the pointer that's special, it's the name.

Somehow I can't bring myself to call this wrong :-)
-- 
		[rbj@uunet 1] stty sane
		unknown mode: sane