Depending on how long your snake is now, you could use the cardboard tube (cut or add to it accordingly) from a paper towel roll and place it on the inside of your snakes enclosure next to the glass then entice him to go through the tube by placing food on the far end of the tube. This method will allow him to feel safe in the tube so that his body is straight, and with a tape measure you can measure him from the outside of the enclosure.

Or you can use this app. Serpwidgets - Snake Measurer