in reply to Re^2: Demonize Module, What are your thoughts?
in thread Demonize Module, What are your thoughts?
I haven't read through the rewrite.
What I meant about passing a code reference is using an anonymous sub.
# create code reference my $anon_sub = sub { print "Hello world!\n" }; # execute the code $anon_sub->();
For Daemonize, it would look something like...
my $run = sub { die 'unfinished' }; my $d = Daemonize->new( run => $run ); # later, inside Daemonize $self->{run}->( $self );
I think it would be a good idea to pass the Daemonize object to the sub itself (as I did in the example) so it can call methods on it (like logging) if it wants to.
I'm not quite clear about what you're trying to do with $SIG{__DIE__}, but you might want an END block or a DESTROY method instead.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Demonize Module, What are your thoughts?
by halfbaked (Sexton) on Dec 17, 2008 at 18:18 UTC | |
by kyle (Abbot) on Dec 17, 2008 at 21:51 UTC |