in reply to using modules already 'used'
What you want is what the heavy-OO people call a "singleton". You could write one yourself (WARNING! Untested code!):
Now, say "$q = CGI::Single->instance" instead of "$q = new CGI".package CGI::Single; our @ISA; @ISA = ('CGI'); my $instance; sub instance { defined $instance or $instance = new CGI; $instance; } 1;
Or, CPAN has Class::Singleton, which should let you just say (again, untested!), mixin-style,
with the same use as before.package CGI::Single; our @ISA; @ISA = qw(CGI Class::Singleton); 1;
|
---|