in reply to how watch a variable
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how watch a variable
by karlgoethebier (Abbot) on Dec 10, 2023 at 20:00 UTC | |
by LanX (Saint) on Dec 10, 2023 at 20:27 UTC | |
|
Re^2: how watch a variable
by Anonymous Monk on Dec 10, 2023 at 16:14 UTC |