in reply to Difference between executing and "using" a .pm file

There are a couple of problems with executing a module as a modulino. And it's totally unnecessary. Load the module properly.

perl -e'use ConfigFile; ConfigFile::validate()'
which can be written as
perl -MConfigFile -e'ConfigFile::validate()'

Seeking work! You can reach me at ikegami@adaelis.com

Replies are listed 'Best First'.
Re^2: Difference between executing and "using" a .pm file
by Marshall (Canon) on Mar 31, 2021 at 03:46 UTC
    My thought was just: perl ConfigFile.pm where, when run as an executable, it runs the validate() routine.

    I am just looking for simple syntax for my user which eliminates a trivial driver program. This is probably not that big of a deal. And it could also be that this confuses the issue even more and is a bad idea! It could wind up being that I need to build a GUI to assist generation of this config file.

      Yes, and to that I said: There are a couple of problems with executing a module as a modulino. And it's totally unnecessary. Load the module properly.

      Seeking work! You can reach me at ikegami@adaelis.com

        Thanks! I appreciate your comments! I am planning for a major new code release and this is just one small part. This is a time for me to reexamine previous decisions and designs. After 2+ years of negotiations, I finally convinced one website to give an efficient XML I/F with the features that I need and which also fits into this guy's plan for his website. This sort of thing sounds "easy", but in practice, it is not. I won't get what I "wanted", but I will get what I "need". And that will be enough.