|
Posted by Brian McCauley on February 25, 2005, 7:37 pm
Please log in for more thread options
DJ wrote:
>
> $SIG = &catch_hup;
> $SIG = &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 = Module->catch_hup;
> $SIG = Module->catch_int;
No, do the same thing you did in the first case:
$SIG = &Module::catch_hup;
$SIG = &Module::catch_int;
Or, of couse, you could have Module export them (using Exporter).
> 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.
No there is no difference, if you had said...
$SIG = catch_hup;
$SIG = catch_int;
....it would not have worked either.
|