http://www.perlmonks.org?node_id=703039


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; }
  • Comment on Re: Using a log object in another object without passing it as a parameter
  • Download Code