http://qs321.pair.com?node_id=11110733


in reply to My promiscous singleton

Probably this:

my $instance = shift; # settings to use $instance = {} unless $instance;

Replies are listed 'Best First'.
Re^2: My promiscous singleton
by Random_Walk (Prior) on Dec 30, 2019 at 00:26 UTC

    Spot on sir. Face palm time. Thanks for pointing that out.

    Now I remove that extra my it all works as desired:

    Get instance called from main Not yet instantiated $VAR1 = bless( { 'Log' => 0, 'Screen' => 0 }, 'Helper::Logger' ); Mon Dec 30 01:25:32 2019 Log1 Get instance called from main Already instantiated Setting new values $VAR1 = bless( { 'Log' => 4, 'fh' => \*Helper::Logger::__ANONIO__, 'LogName' => 'CommandLine.log', 'Screen' => 0, 'LogDir' => '/home/random/log', '_continuation' => 0 }, 'Helper::Logger' ); $VAR1 = bless( { 'Log' => 4, 'fh' => \*Helper::Logger::__ANONIO__, 'LogName' => 'CommandLine.log', 'Screen' => 0, 'LogDir' => '/home/random/log', '_continuation' => 0 }, 'Helper::Logger' );

    Both nicely point to the same object. Perfect

    Thanks,
    R.

    Pereant, qui ante nos nostra dixerunt!