in reply to RE: Setting up signal handlers for an object with access to $self in thread Setting up signal handlers for an object with access to $self
The point is to give the signal handler access to an object.
If you simply point the signal handler to a subroutine,
you do not have a way of accessing $self, unless it is stored
in a class variable. By defining the signal handler with
a closure, you can call the signal handler as if it were
a method instead of a regular subroutine, therefore giving
it access to $self (and the ability to access its
methods and data).
|