是否有一种标准方法可以在安装时为 Perl 脚本设置站点特定值?

发布于 2024-09-30 12:12:23 字数 959 浏览 0 评论 0原文

可能的重复:
在 Perl 脚本中分离配置数据和脚本逻辑 < /p>

< a href="http://bazaar.launchpad.net/~cwhii/stevedore/trunk/annotate/11/stevedore/src/server/StevedoreUtil.pm" rel="nofollow noreferrer">StevedoreUtil.pm 集用于电子邮件地址的值:

my $STEVE_SITE_EMAIL_DOMAIN = "mydomain.net";

不幸的是,这不应该在 Perl 脚本中硬编码。首次安装应用程序时是否有标准方法可以设置这样的值?

请参阅 Stevedore 项目,位于 launchpad.netStevedore 网站 的上下文 StevedoreUtil.pm

Possible Duplicate:
Separating configuration data and script logic in Perl scripts

StevedoreUtil.pm sets a value used for email addresses:

my $STEVE_SITE_EMAIL_DOMAIN = "mydomain.net";

Unfortunately, this should not be hard coded in the Perl script. Is there a standard way to set a value like this once when the application is first installed?

See Stevedore Project on launchpad.net and the Stevedore Web Site for the context of StevedoreUtil.pm.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

﹏雨一样淡蓝的深情 2024-10-07 12:12:23

ExtUtils::MakeMakerModule::Build 都具有运行带有 *.PL 扩展名的脚本的功能,以便在安装时创建新文件。某些发行版包含名称如 Foo.pm.PL 的文件来创建 Foo.pm 等文件。

Both ExtUtils::MakeMaker and Module::Build have facilities for running scripts with the *.PL extension to create new files at installation time. Some distributions include files with names like Foo.pm.PL to create files like Foo.pm.

伴我心暖 2024-10-07 12:12:23

好吧,Config 模块中的 $Config{perladmin} 的值适用于 Perl 本身,并在构建时确定:

% perl -V:perladmin
perladmin='[email protected]';

但是,我不知道支持给定模块/类/文件的此类概念的任何类型的约定。获得 UNIVERSAL->VERSION() 支持已经够难的了。

不过,你的想法可能有些道理。如果其他地方没有讨论过的话,我会感到有点惊讶。对各种模块构建机制的文档进行快速检查并没有发现任何明显的结果。

Well, the value of $Config{perladmin} out of the Config module has something that works for Perl proper and is determined at build time:

% perl -V:perladmin
perladmin='[email protected]';

However, I’m unaware of any sort of convention for supporting that sort of notion for a given module/class/file. It’s hard enough getting UNIVERSAL->VERSION() support.

Still, there may be something to your idea. I’d be somewhat surprised if it hadn’t already been discussed elsewhere. A really quick check on the documentation for the various module build mechanisms didn’t turn up anything obvious.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文