in reply to Re^3: Design of a global-variable storage package (string)
in thread Design of a global-variable storage package
Rather than try to detect, I'd probably do something deterministic like export functions that use the singleton:
package Getopt::Long::Framework; use vars qw( @EXPORT_OK ); @EXPORT_OK= qw( Foo Bar Baz ); require Getopt::Long::Framework::Object; my $singleton = Getopt::Long::Framework::Object->new(); sub Foo { $singleton->Foo( @_ ); } ... sub GetObjectPackage { "Getopt::Long::Framework::Object"; } sub new { my $class= shift @_; $class = $class->GetObjectPacket() if $class->can("GetObjectPacket"); ... }
(in part, because I prefer to keep my class methods and object methods in separate 'package's anyway)
- tye
|
|---|