Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Main routines, unit tests, and sugar

by perlfan (Curate)
on Jun 19, 2013 at 15:47 UTC ( #1039795=note: print w/replies, xml ) Need Help??

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1039795]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2018-06-23 03:39 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (125 votes). Check out past polls.