The Pencil Guy: Hourann's illogical blog

Ugly error messages in Perl modules

Maybe this will save some stress for someone else who is, as I presently am, stuck cooking Perl late at night.

If you’re doing anything with the URI module, or using a module that calls URI (in my case, WWW::RobotRules) and you get this error …

Can't locate object method "host" via package "URI::_generic"

… check that the URL that you are feeding to it is happy, good, and fully-qualified. Then check it again. No, seriously, make sure it’s got everything a URL should have, including boring stuff like protocols and trailing slashes.

In my case, after various forms of cursing and suspicions that the Debian folks had incorrectly packaged a module somewhere, I discovered that feeding http://foo.bar/robots.txt to WWW:RobotRules, rather than foo.bar/robots.txt, made it all just work. Mutter grumble stupid non-descriptive error message …

  1. Dont you just love programming and it’s semantics :) It’s good to see im not the only one who grumbles about illformed code :]

Care to leave a comment?