What are valid Perl module return values?

后端 未结 6 1323
暗喜
暗喜 2020-12-17 14:39

The common practice in Perl is of course to end modules with 1; so that a call to require can then be checked for success. Is there any reason that the return

6条回答
  •  长情又很酷
    2020-12-17 15:03

    One thing that you'll run into with require is that it only returns the module's return value the first time that the module is loaded. If the module was already loaded, require returns 1 without loading the module again.

    The do file statement will reload the file each time, and returns the file's return value each time. I've used it to store configuration data in a file in the form of an anonymous hash.

提交回复
热议问题