Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2016-10-28 22:36 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (387 votes). Check out past polls.