in reply to Re: Can't call method "curselection" on an undefined value
in thread Can't call method "curselection" on an undefined value

If no selection is made $lst->curselection is undefined

According to the posts title the problem of the OP seems to be, that $lst is undefined rather than the returnvalue of the curselection() call. His code example does not show that behavior, so it's hard to guess what's going on."


Cheers, CHristoph

Replies are listed 'Best First'.
Re^3: Can't call method "curselection" on an undefined value
by GrandFather (Saint) on Apr 13, 2011 at 09:53 UTC

    The warning I highlighted is the only issue of that sort that the OP's sample code generates. My suspicion is that what we've been shown is a cleaned up version of the OP's real code and that the actual bug has been cleaned up in the process. Most likely that bug is related to using $lst as a global and is a result of it being altered somewhere in the code we're not shown. There is a reasonable chance that using the call back technique I demonstrated may solve the OP's problem.

    Quite likely the curselection undefined warning is a red herring, but avoiding globals may well fix the actual problem regardless.

    True laziness is hard work