in reply to Re^2: Object passing within a package
in thread Object passing within a package

Hmmm... if all things need to access the Curses::UI object, you might consider creating giving each of their objects a reference to the Curses::UI object. It should be the same object (so you don't have multiple ones), but then every time you call a method, you already have it in the object data. In that case you don't need to pass it around.

Sometimes the Singleton design pattern can solve this little sanfu, too. There is a Perl Singletons on Perl Monks, or my article about Singletons in The Perl Review, Issue 0.1

--
brian d foy <bdfoy@cpan.org>

Replies are listed 'Best First'.
Re^4: Object passing within a package
by naChoZ (Curate) on Jan 18, 2005 at 14:31 UTC

    That's great. At the time I didn't know what it was called at the time, but Kanji showed me a singleton construct one time. I just couldn't quite figure out how to apply it to what I was doing here. This was very helpful. Thanx!

    --
    "This alcoholism thing, I think it's just clever propaganda produced by people who want you to buy more bottled water." -- pedestrianwolf