in reply to STDIN not working, STDIN hanging

I believe the above examples should work as is without any Modules.

They won't, because that's not how the CGI protocol works. If you're going to code a CGI processor by hand, you need to read the specification of the protocol (but don't write your own CGI processor; it's a lot of busy work to work around browser bugs and multiple specifications and server bugs).