I knew CPAN wouldn't let me down. Now I can discard my own OS/platform detecting code (which probably is buggier and not nearly as extensive) and rely on Devel::Platform::Info instead.
Devel::Platform::Info gives information not only about the OS but also architecture, kernel type & version, etc. In my case I need to detect distro name, its version, and its codename. All of those are provided.
This module is so new though (started in 2010) so I wonder whether this need has never come up before.