Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Singleton and unblessed refereces.

by rjt (Deacon)
on Jul 08, 2013 at 12:16 UTC ( #1043104=note: print w/replies, xml ) Need Help??

in reply to Singleton and unblessed refereces.

Works for me with dummy objects:

#!/usr/bin/env perl use 5.012; use warnings; use myDebugger; my $instance = myDebugger::GetInstance(); say ref($instance); $instance->{foo} = 'Persistent'; # Ensure we get same instance my $instance_ref2 = myDebugger::GetInstance(); say ref($instance_ref2); say $instance_ref2->{foo};

package myDebugger; use 5.012; use warnings; my $debugger; sub GetInstance { return $debugger //= bless { foo => 'bar' }, 'OLEThingy'; } 1;


OLEThingy OLEThingy Persistent

I suggest you eliminate this code and focus on the object in question; boil it down to a small test case, and the problem might solve itself, or you can of course come back here armed with more information.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1043104]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2017-06-26 06:30 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (572 votes). Check out past polls.