He COULD be hungry..... or startled/scared/surprised/cold/angry/pissy/woke-up-on-the-wrong-side-of-the-bed/didn't like what you were wearing/thought you smelled funny/saw a mouse in the corner of the room/trying to give you a kiss/etc.
There are myriad reasons as to why he may have struck at the cage. I would go with any one of the first three of my smartalek replies.
How long have you had him, and when did he last eat? Is there ample space/hide space in his enclosure? What are the temps like? Do you have a cat, or small children, or anything else that may relentlessly torment the snake? These can all cause stress in snakes, and it is usually a stressed or hungry snake that will strike. But usually, a strike in a cage is indicitive of a defensive strike, not a hunting strike.
Sorry I didnt answer your question specifically, but I hope this post sheds light on why I can't.