I'd go for Tie::Scalar for such a case. It is part of the core modules.
In your class based on Tie::Scalar you then override the STORE method with one which calls your routine, and then the original STORE from the base class. perltie gives an overview about the technique.
In reply to Re: call subroutine if scalar is changed
by haj
in thread call subroutine if scalar is changed
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |