Subject: | improve how Init() determines whether it was passed a blessed object |
The Init() method uses ref() to determine whether the provided $self
variable is a Proc::Daemon object or not. That logic doesn't work when
the Proc::Daemon has been sub-classed. The attached patch uses
UNIVERSAL::isa() to determine inheritance, instead.
Subject: | proc-daemon.patch |
--- Daemon.pm.bak 2011-03-29 11:26:37.000011000 -0500
+++ Daemon.pm 2011-03-31 12:30:19.000020000 -0500
@@ -78,7 +78,8 @@
# Check if $self has been blessed into the package, otherwise do it now.
- if ( ref( $self ) ne 'Proc::Daemon' ) {
+ my $ready = eval { $self->isa('Proc::Daemon') };
+ if ( $@ || ! $ready ) {
$self = ref( $self ) eq 'HASH' ? Proc::Daemon->new( %$self ) : Proc::Daemon->new();
}
# If $daemon->Init is used again in the same script,