In Perl, how can I find out if my file is being used as a module or run as a script?

后端 未结 3 391
旧巷少年郎
旧巷少年郎 2020-12-10 05:04

Let\'s say I have a Perl file in which there are parts I need to run only when I\'m called as a script. I remember reading sometime back about including those parts in a mai

3条回答
  •  温柔的废话
    2020-12-10 05:48

    I call these things "modulinos" originally in my Scripts as Modules article for The Perl Journal (now Dr. Dobbs). Google that term and you get the right resources. Sinan already linked to my development sources for one of my books where I talk about it. You might also like How a Script Becomes a Module.

提交回复
热议问题