__PACKAGE__ always prints out the current package, and in a script (that doesn't declare its own package) that has been included via "do" or "require", __PACKAGE__ still is "main".
An inelegant solution is a create a global variable when the first script begins it's main path of execution, and check for that in each submodule. But the elegant way escapes me.