hoppfrosch has asked for the wisdom of the Perl Monks concerning the following question:
My idea is to construct a "tied Singleton" by both inheriting from tie::refhash::nestable and Class::StrongSingleton.
What I did yet in my module file:
This doesn't work, since $self = Tie::RefHash::Nestable->TIEHASH($self, $class); returns a Tie::RefHash::Nestable-object - but what I want to get back is a GlobalHash object ...package GlobalHash; use vars qw(@EXPORT @EXPORT_OK $VERSION $REVISION $AUTOLOAD @ISA); use Exporter; ... use Tie::RefHash; use Class::StrongSingleton; use base qw(Class::StrongSingleton Tie::RefHash::Nestable ); sub TIEHASH { my $proto = shift; my $class = ref($proto) || $proto; my $self = {@_}; $self = Tie::RefHash::Nestable->TIEHASH($self, $class); # initialize it as a singleton $self->_init_StrongSingleton(); $self->{'START'} = scalar localtime; return $self; }
Any help welcome
Hoppfrosch
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Multiple Inheritance - Howto marry tie::refhash::nestable with class::singleton
by merlyn (Sage) on May 31, 2005 at 12:05 UTC | |
by hoppfrosch (Scribe) on May 31, 2005 at 13:14 UTC | |
by merlyn (Sage) on May 31, 2005 at 13:43 UTC | |
by hoppfrosch (Scribe) on May 31, 2005 at 14:12 UTC | |
by dragonchild (Archbishop) on May 31, 2005 at 13:26 UTC | |
|
Re: Multiple Inheritance - Howto marry tie::refhash::nestable with class::singleton
by brian_d_foy (Abbot) on May 31, 2005 at 19:58 UTC | |
|
Re: Multiple Inheritance - Howto marry tie::refhash::nestable with class::singleton
by GoCool (Scribe) on May 31, 2005 at 17:32 UTC |