Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: My promiscous singleton

by kikuchiyo (Friar)
on Dec 29, 2019 at 18:09 UTC ( #11110733=note: print w/replies, xml ) Need Help??


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!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11110733]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2022-08-10 04:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?