if you're happy with not understanding why glib works, that's your call.
Oh I don't understand how most modules do what they actually do, thats why I use them. For what it's worth, the code you are probably looking for is in gio/gsocket.c
For me to guess at how to do it with plain select, I think you need to figure out how to access the socket's errno. See getting errno. From Perl you probably need to use sysctl.ph
P.S. Glib is not the only lib out there, many prefer AnyEvent. Have you looked at how AnyEvent works against your socket blocker program?