Re: testing scripts inside your distro

[email protected] (Olivier Mengué)
Newsgroups perl.cpan.testers.discuss
Message-ID <CAEWvDFKYU7PjQN65W0cmH7TkDhdwfUpopQM2mvg0Pme3jP_=bA@mail.gmail.com>
2018-03-01 15:00 GMT+01:00 yary <[email protected]>:

> Something to do in small scripts which don't aren't module material, is to
> put all the "useful" code into subs, put the command-line processing &
> printing into a "sub MAIN", and then have only this top-level statement:
>
>     exit MAIN unless caller;
>

This approach is called a "modulino". See those articles:
https://perlmaven.com/modulino-both-script-and-module
https://www.perl.com/article/107/2014/8/7/Rescue-legacy-code-with-modulinos/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.