http://qs321.pair.com?node_id=548154


in reply to How a script becomes a module

I've been using this technique and found it helpful for testing, among other things. Today I hit a snag while packaging my code with PAR. After a bit of debugging I discovered that packaged files don't have an empty caller so to make PAR friendly modulinos use something like:
__PACKAGE__->run() if !caller() || caller() eq 'PAR';