Man survives a month in bear den that was planning to eat him later