in reply to Re^2: Any one know how to use sigtrap with moose?
in thread Any one know how to use sigtrap with moose?
You could try something along the lines of:
use MyPackage; my $newest_instance; after BUILD => sub { $newest_instance = shift; };
And then in your signal handler, call:
if ($newest_instance) { $newest_instance->status("killed"); $newest_instance->end; }
Note that if there is more than one object of class MyPackage knocking around, this will only set the status on the newest (i.e. most recently constructed) object.
Depending on exactly what you're doing, and how many instances of MyPackage you expect to exist in the lifetime of a process, you may need something else.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Any one know how to use sigtrap with moose?
by Corion (Patriarch) on Jul 24, 2012 at 11:47 UTC | |
by tobyink (Canon) on Jul 24, 2012 at 13:49 UTC | |
|
Re^4: Any one know how to use sigtrap with moose?
by hisycg@gmail.com (Initiate) on Jul 24, 2012 at 12:23 UTC |