The bug may disappear if you install Readonly::XS ... not sure - just a thought.
Readonly::XS provides about the simplest way there is of making scalars readonly. (Note that you don't explicitly "use Readonly::XS;". You just install it and Readonly will automatically use it for making scalars readonly.)