in reply to Tk::Entry widget with textvariable and validatecommand

I found one (ugly) way to do it:

Instead of directly changing the textvariable contents, I delegate this to a slightly later point using an "after" call. So instead of the line

$textvar = $new & 3;
I use this code line:
$mw->after(10, sub { $textvar = $new & 3 });

Btw.: Doing the change of the textvariable contents in the invalidcommand callback also turns the validate option to 'none'.