in reply to passing Curses object to subroutine

Your constructor should be
my $cui = new Curses::UI;
This problem would stop the rest of your code in its tracks.

Most (all?) objects are references, so passing them by value to subroutines should allow you to invoke methods on them while in the sub.

-Mark

Replies are listed 'Best First'.
Re: Re: passing Curses object to subroutine
by emilford (Friar) on Apr 14, 2004 at 01:35 UTC
    In my actual code, I do use the new construct. My mistake.

    My code works fine until I attempt $window->getobj('p3')->{-text} = "Something"; on a variable passed to a subroutine as &UpdateP3($window). I get an error stating 'getobj' can't be used/called on an undefined variable. If all objects are references, I should be able to pass it to a subroutine and invoke the getobj method, right?
      The syntax you describe sounds valid (drop the & though, it does funky stuff), so you've probably screwed up actually doing it. I can't guess where or how though without seeing a small sample case that demonstrates the problem.