For anyone else that finds this post when searching for a solution to this issue...
For me it was because I had spaces before the '---' in my config file so the yaml object wasn't being created. It would be useful to have a check and output YAML::Tiny->errstr in the example for n00bs like myself :)
I ran into the same issue (Can't call method "write" on unblessed reference at ...).
In my case the yaml did not contain a newline.
+1 for making the example check for YAML::Tiny-errstr