in reply to Can't call method "value" on an undefined value at X??

The mantra "always check your return values" isn't just for "open". You're calling ->get and then steamroll ahead without checking if the resource could actually be fetched. And then you do the same with ->form_number.
I think this is where the error gets trown,
You think? That would be trivial to check, wouldn't it? If that's what's triggering the error, you wouldn't see it if you'd exited the program just before.