in reply to How to convert a symbolic reference to a hard reference

Perhaps the simplest fix would be to change the & to *.
*M::x = eval "&$s";
change to
*M::x = eval "*$s";