I had to read multiple times, because my first instinct was using a Tie::Scalar mechanism and you ruled out Tie::Watch .
But tie has no callback to report changing of the internal representation. Mostly because it's supposed to be transparent.
The only way I see in pure Perl without XS is using the debugger with a complicated watch expression.
This will come with a considerable speed penalty
It might help to know why you need this and which problem you are trying to solve.
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
It might be worth checking if $c >120 triggers a tie FETCH, like that you could trace the internal casting and raise an alarm after a change happened.
SO: How are scalars stored 'under the hood' in perl?
In reply to Re: how watch a variable
by LanX
in thread how watch a variable
by xiaoyafeng
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |