in reply to Detecting interactive/non-interactive shell
In the addition to the trivial tests already mentioned (which I use myself), TheDamian wrote IO::Interactive, which seems to try to be a better mousetrap. I'm not sure what problems the module tries to solve that aren't already solved by -t. From looking at the documentation, it seems to act differently if there are files given to process via @ARGV resp. *ARGV, and ties interactivity to the magical "-" filehandle / filename.
Personally, I would turn to IO::Interactive only if the plain -t tests on STDIN or STDOUT don't do what I want.