On 2012.11.30 6:04 PM, David Christensen wrote: > I want one file that can be used: > > 1. As a module (*.pm) and as a script (executable *.pl, or just executable > base name with no extension) on machines where I want to install Perl modules; > and > > 2. As a stand-alone script on machines where I don't want to install Perl > modules.
To solve 1 I would suggest doing what most of the App::* modules do. Put all the logic into the .pm file and make the program a thin wrapper around it. App::Ack for example. https://metacpan.org/release/ack This is far simpler to write for, use and test. For 2 you can use App::Fatpacker to generate the stand alone version. This is what cpanminus does. The advantage is you are not limited to a single .pm file and it handles dependencies. https://metacpan.org/module/App::FatPacker https://metacpan.org/source/MIYAGAWA/App-cpanminus-1.5018/bin/cpanm -- Just call me 'Moron Sugar'. http://www.somethingpositive.net/sp05182002.shtml