in reply to Re: Debugging with tied variables
in thread Debugging with tied variables

You forgot to provide a SCALAR method...oh no, wait, that's only a method for tied hashes :)

It looks ok. I would have made it subclass Tie::StdScalar, but scalars are simple enough that it is probably more work to do that. If you do it for hashes or arrays, its more clear that subclassing is the way to go.

For those who are unaware, the perl core has classes Tie::StdHash, Tie::StdArray, Tie::StdScalar, and Tie::StdHandle that just act like normal hashes, arrays, scalars, and filehandles (to the extent possible through the tie interface). For less than obvious reasons, these classes are in files named without the "Std", so, for example, to tie with Tie::StdScalar, you need to say use Tie::Scalar.

Update: since you are storing the variable name, you would need to subclass the Tie::Extra* versions that allow extra storage, and so far only Tie::ExtraHash has actually been written :(.

Update: you might want to log caller() information, too.