in reply to How Was My Script Run?

Assuming you aren't mucking around with pseudo terminals when calling your slave programs, you could just check whether STDIN is a terminal:
if (-t STDIN) { # Ran from the command line }
This is a fairly standard way to check whether a program is run interactively (from the command-line) or not.

An alternative way is to inspect the parent process. getppid returns the process ID of the parent, and from there you can work your way up.

But I'd go the "check whether STDIN is a terminal" way.