I stand corrected. The code in the recipe is actually correct.
SV* obj_ref = newSViv(0);
SV* obj = newSVrv(obj_ref, class);
newSVrv doesn't create a reference as a I had guessed, it returns a new SV and makes obj_ref a reference to it. WTF? How odd is that!!!
So obj_ref holds a reference to the blessed scalar in obj, which in turn contains an integer which corresponds to the memory address of the C object.
set_iv is not being used on the reference, so there are no issues wrt to recent changes in scalar types.