你为什么要放一个1?在Perl 5模块的末尾? [英] Why do you have to put a 1; at the end of a Perl 5 module?
本文介绍了你为什么要放一个1?在Perl 5模块的末尾?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么所有Perl 5模块都必须以1;
结尾?
Why do all Perl 5 modules have to end with 1;
?
推荐答案
Perl模块必须以真值结尾,否则将被认为不 已加载.按照惯例,该值通常为1,尽管可以为 任何真实的价值.模块可以以false结尾以指示失败,但是 这很少使用,它会改为die()(错误退出).
A Perl module must end with a true value or else it is considered not to have loaded. By convention this value is usually 1 though it can be any true value. A module can end with false to indicate failure but this is rarely used and it would instead die() (exit with an error).
来源: Wiki
这篇关于你为什么要放一个1?在Perl 5模块的末尾?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文