What you're describing sounds to me like a modulino.
Update: In a nutshell, the way it's done is something like this:
package Foo; _run( @ARGV ) if ! caller; sub _run { # Do stuff as a program }
It's using caller to tell whether it's being executed "at the top level". If you search for modulino on CPAN, there are a few examples to look at.
In reply to Re: conditional self-execution
by kyle
in thread conditional self-execution
by apotheon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |