Class::Singleton 1.03 bug fixed but can"t contact author. What todo?
am 21.11.2006 21:20:00 von Craig Manley
I patched Class::Singleton because when objects were being stored in an instance of it, their destructors weren't being
called when Perl terminates. Also incorporated is a CVS tag patch so that a "cvs export -kv" doesn't cause syntax errors.
Unfortunately the author (Andy Wardley http://www.andywardley.com/) hasn't replied to any of my emails and it's been 2 weeks
already. So what should I do in such a situation? I think quite a lot of people use this class and perhaps some of them can
benefit from the patch.
-Craig Manley
Below is the tiny diff for who cares.
--- c:\Perl\site\lib\Class\Singleton.pm Fri Jun 14 11:56:20 2002
+++ fixed\Singleton.pm Tue Nov 21 21:04:48 2006
@@ -13,7 +13,7 @@
#
#----------------------------------------------------------- -----------------
#
-# $Id: Singleton.pm,v 1.3 1999/01/19 15:57:43 abw Exp $
+# $Id: Singleton.pm,v 1.3 2006/11/21 20:04:48 cmanley Exp $
#
#=========================================================== =================
@@ -22,10 +22,13 @@
require 5.004;
use strict;
-use vars qw( $RCS_ID $VERSION );
+use vars qw( $RCS_ID $VERSION %_INSTANCES);
+$VERSION = sprintf '%d.%02d', q|$Revision: 1.3 $| =~ m/ (\d+) \. (\d+) /xg;
+$RCS_ID = q|$Id: Singleton.pm,v 1.3 2006/11/21 20:04:48 cmanley Exp $|;
-$VERSION = sprintf("%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/);
-$RCS_ID = q$Id: Singleton.pm,v 1.3 1999/01/19 15:57:43 abw Exp $;
+END {
+ undef(%_INSTANCES); # dereferences and effectively causes the proper destruction of all instances.
+}
@@ -59,14 +62,14 @@
sub instance {
my $class = shift;
-
- # get a reference to the _instance variable in the $class package
- no strict 'refs';
- my $instance = \${ "$class\::_instance" };
-
- defined $$instance
- ? $$instance
- : ($$instance = $class->_new_instance(@_));
+ if (ref($class)) {
+ return $class;
+ }
+ my $instance = $_INSTANCES{$class};
+ unless(defined($instance)) {
+ $_INSTANCES{$class} = $instance = $class->_new_instance(@_);
+ }
+ return $instance;
}
Re: Class::Singleton 1.03 bug fixed but can"t contact author. Whatto do?
am 22.11.2006 20:31:13 von Mark Clements
Craig Manley wrote:
> I patched Class::Singleton because when objects were being stored in an
> instance of it, their destructors weren't being called when Perl
> terminates. Also incorporated is a CVS tag patch so that a "cvs export
> -kv" doesn't cause syntax errors. Unfortunately the author (Andy Wardley
> http://www.andywardley.com/) hasn't replied to any of my emails and it's
> been 2 weeks already. So what should I do in such a situation? I think
> quite a lot of people use this class and perhaps some of them can
> benefit from the patch.
I've found him pretty responsive in dealing with bug reports in the
past. It's possible he is / has just been on holiday. Try filing a bug
report at rt.cpan.org, bearing in mind it helps if you have a test case
that demonstrates the bug.
Mark
Re: Class::Singleton 1.03 bug fixed but can"t contact author. What to do?
am 23.11.2006 01:23:46 von Sisyphus
"Craig Manley" wrote in message
news:45635f70$0$333$e4fe514c@news.xs4all.nl...
> I patched Class::Singleton because when objects were being stored in an
instance of it, their destructors weren't being
> called when Perl terminates. Also incorporated is a CVS tag patch so that
a "cvs export -kv" doesn't cause syntax errors.
> Unfortunately the author (Andy Wardley http://www.andywardley.com/) hasn't
replied to any of my emails and it's been 2 weeks
> already.
For an alternative address, see the "AUTHOR" section of the module's
documentation. (No guarantee that will find him, either :-)
> So what should I do in such a situation? I think quite a lot of people use
this class and perhaps some of them can
> benefit from the patch.
This module has not been updated in nearly 8 years - there's a good chance
it has been abandoned.
The following is copy'n'pasted from a post by xdg at
http://www.perlmonks.org/index.pl?node_id=489185:
"If the author can be contacted and is willing to transfer, they can
transfer ownership by changing permissions at PAUSE . If the module has been
abandoned and the author cannot be contacted, emailing modules@perl.org
about taking over maintenance and transfering permissions is right the way
to get started. "
Other than that, you could always create your own version of the module (in
a different namespace) that incorporates your patch(es).
I would also submit a bug report to
http://rt.cpan.org/Public/Dist/Display.html?Name=Class-Singl eton that
includes the patch you provided - as others might find it useful (and
rt.cpan.org is the first place they ought to check).
Cheers,
Rob