http://www.perlmonks.org?node_id=244260


in reply to Re: Possible to have a module act as a standalone??
in thread Possible to have a module act as a standalone??

you want a module that can be run as a script, but the search paths for scripts (OS determined) and modules (Perl determined) are different. if it's in a place where it could be run as a script, then it can't be loaded as a module w/o hackery. ditto for the reverse, if it's in a place where it could be loaded as a module (use Foo;) then it's not in a place where it could be called as a script.
Jigga-what? There is nothing saying that @INC and your PATH environment variable have to be disjoint. I'm not saying that it's a good idea to have overlap (nor am I saying that it's a bad idea; kinda titilating, actually), but you could put a new directory that is understood to contain such hybrid scripts at the end of both @INC and PATH:
push @INC, "/path/to/hybrids" setenv PATH $PATH:/path/to/hybrids export PATH=$PATH:/path/to/hybrids ...
You get the idea.

thor