in reply to Re: derefrencing an object
in thread derefrencing an object

I made the change and I still get the same error. Could it be b/c I use my $node in ANodeLogin and once I leave that methode $node evaporates? thanks for your help!

Replies are listed 'Best First'.
Re: Re: Re: derefrencing an object
by Thelonius (Priest) on May 03, 2004 at 17:46 UTC
    Could it be b/c I use my $node in ANodeLogin and once I leave that methode $node evaporates?

    That shouldn't be a problem. The object should still exist as long as there's a reference to it. It's hard to say what's wrong looking at just these few lines. What I would probably try next is to add:

    use Data::Dumper; print Dumper($node);
    right before line 62.

    Update: Given what sgifford says below, I would suspect either (1) you have another code path which adds to @nodes, or (2) you didn't change the code you were running. In fact, one reason I suggested adding the print Dumper statement was to make sure that you were changing (and saving) the right code. Don't feel too bad if this happens to you. I have to be on the guard against this all the time; it has happened to me too many times over the years. Given how Perl can search many places for a module, that I have two different versions of Perl on my PC, that I often edit on a different system from the one I run on, that there are development, test, and production environments, etc., etc. you have to keep on your toes. Eternal vigilance!

Re: Re: Re: derefrencing an object
by sgifford (Prior) on May 03, 2004 at 17:48 UTC
    This fix works for me. I'm running this program: and it outputs:
    What node would you like to log out of
    --->0<---
    --->1<---
    --->2<---
    --->3<---
    
    Without the fix from Thelonius, I get the error you were seeing.

    Maybe the problem is being introduced elsewhere in your program.