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


in reply to Main routines, unit tests, and sugar

Personally, I really like brian's modulino approach, but I use it sparingly.

Main methods are one of the things that LPW wanted to do away with, or make implied (as many other things are).

Yes, the main() or however you do it will make it more familiar with those comfortable with compiled languages. However, it's not really useful unless you're going to be taking advantage of it for things like unit testing.

Where brian's modulino approach shines for me are situations where I am writing a utility that generating a useful set of subroutines for a related set of utilities. With the modulino, I get the ability to run it as a utility or include it as a library in a related util. I get to create unit tests as well.

So, I would highly recommend that approach in these situations, rather than just arbitrarily creating a main() method.

  • Comment on Re: Main routines, unit tests, and sugar