in reply to Using a log object in another object without passing it as a parameter
You need to use the Singleton pattern. Something like:
package Log; my $instance; ... sub get_logger { unless ($instance) { $instance = ...; # create the Log instance here # another option is to throw an exception } $instance; }
|
---|
In Section
Seekers of Perl Wisdom