Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

RE: RE: RE: Setting up signal handlers for an object with access to $self

by chromatic (Archbishop)
on Apr 20, 2000 at 02:41 UTC ( [id://8089]=note: print w/replies, xml ) Need Help??


in reply to RE: 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

Because I like CODE refs way too much:
sub set_signal_handlers { my $self = shift; if (!%handlers) { # Class signal handler, only set the first time $SIG{USR1} = \&class_handle_USR1; } # You could index by $self->name, or by any other identifier $handlers{$self} = $self->handle_USR1(); } # skip a few sub handle_USR1 { my $self = shift; return sub { print "handling USR1 for ", $self->name, "\n"; } }
That fits all of my definitions of beautiful.
  • Comment on RE: RE: RE: Setting up signal handlers for an object with access to $self
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://8089]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (1)
As of 2024-04-25 07:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found