Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Main routines, unit tests, and sugar

by vsespb (Chaplain)
on Jun 16, 2013 at 15:07 UTC ( [id://1039207]=note: print w/replies, xml ) Need Help??


in reply to Main routines, unit tests, and sugar

I prefer the following approach:

Main .pm file is just a normal .pm file

There is a tiny .pl script with executable permissions which call main() in main module

This script is possibly autogenerated or uses FindBin to setup @INC

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

Replies are listed 'Best First'.
Re^2: Main routines, unit tests, and sugar
by BrowserUk (Patriarch) on Jun 16, 2013 at 15:16 UTC

    Reminds me of the guy that painted a bicycle on the side of his Hummer in an attempt to seem green. :)


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      Why is that?

      Any important code resides under one App::MyApp namespace, and not split across App::MyApp and myapp.pl

      Also different deploy methods can generate different binaries (some with hardcoded paths)

      Same used in Ruby ecosystems - binaries are autogenerate and are almost empty

      Also, if binary autogenerated it might not contain copyright/license notice

        Any important code resides under one App::MyApp namespace, and not split across App::MyApp and myapp.pl

        It was mostly humour, but ... you still need myapp.pl in order to invoke your application.

        Which means you added an extra file (your App::MyAPP.pm) -- and an extra level of callback trace to every error message, etc. etc. -- and made the (still) required file almost empty and what did you gain?

        IMO nothing. You added the need to chase off and track through where this module file lives -- not always obvious with lib, site/lib, site/vendor/lib, use lib et al. -- just in order to see what it does; what its dependencies are ...

        That almost empty file, the .pl, is still used. What is the point in adding an extra file in order to make this one almost empty? There is no logical justification for it.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1039207]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-25 12:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found