catch_int\catch_hup subroutine

From: DJ (dcercone_at_gmail.com)
Date: 02/25/05


Date: 25 Feb 2005 07:51:52 -0800

Has anyone ever used a routine to process signals in a Perl module?

In one of my Perl scripts I have two subroutines defined:

sub catch_hup
sub catch_int

In the main body of my code, I set them up as follows:

$SIG{HUP} = \&catch_hup;
$SIG{INT} = \&catch_int;

This is all defined in the same script file. I would like to move the
subroutine definitions to a Perl module so that I can reuse these
definitions in different Perl scripts. So when I add the two
subroutines (catch_hup and catch_int) into my Module.pm file, I would
like to call them as follows:

$SIG{INT} = Module->catch_hup;
$SIG{HUP} = Module->catch_int;

Is that even possible with Perl? The code that works was inherited and
I have a basic understanding of how it works. Currently I have other
subroutines defined in my Perl module that work fine. However, I'm
sure with signals, it doesn't work the same.

Any help would be appreciated!

Perl rookie!
DJ



Relevant Pages

  • Re: Beginning beginner needing references help
    ... > hard way in an effort to learn more core perl. ... > Now the list of states also includes the counties (fetched ... >> both within and outside subroutines. ... >> You can either do what you've done above, and simply declare ...
    (perl.beginners)
  • RE: Good Intro reading
    ... I won't even quote the url. ... Being a junior perl programmer, I read a lot of docs and I came ... The CGI section is impressive, ... Let's take a look at some typically bad subroutines (the ...
    (perl.beginners)
  • A very general question to perl experts
    ... I am facing a problem day-in and day-out with my perl code. ... a couple of subroutines in it. ... sub setup { ... readDefectData is one of them. ...
    (perl.beginners)
  • Re: Help Perlling a program
    ... >>less repition or lines of code, or in a more Perl like way. ... > You should bundle repitious code into subroutines whenever possible. ... It would probably be more perlish to omit the ''. ...
    (comp.lang.perl.misc)
  • Re: case and functions
    ... People of the Perl, ... thanks for the info....I am familiar with perls subroutines so I will use ... my intention was to avoid ... Is there something similar or did I misread this? ...
    (perl.beginners)