Perl 内置 `Internals::` 包的文档在哪里?

发布于 2024-09-04 03:20:59 字数 651 浏览 0 评论 0原文

当使用 keys %:: 获取当前加载的根命名空间的列表时,默认情况下会加载 Internals:: 包(以及 UNIVERSAL::< /code> 和其他一些)。但是,我没有找到 Internals::

keys %{Internals::} returns SvREFCNT hv_clear_placeholders hash_seed SvREADONLY HvREHASH rehash_seed 中函数的任何文档>

所有这些都可以在 Perl 的 C API 文档中查找,但是有针对它们的 Perl 级别文档吗?包裹稳定吗?它被多个核心模块使用(其中一个是 Hash::Util),所以我想它是这样的,但是缺乏文档有点令人不安。

我在 Perl 发行版中没有看到 Internals.pm(也许名称不同?),并且它不是 CPAN 上的 Internals 模块。

注意:我完全理解 Internals:: 中的函数有潜在危险,并且我没有任何特定用途。我正在阅读 Hash::Util 的源代码并发现了它。

When using keys %:: to get a list of the currently loaded root namespaces, the Internals:: package is loaded by default (along with UNIVERSAL:: and a few others). However, I haven't found any documentation for the functions in Internals::

keys %{Internals::} returns SvREFCNT hv_clear_placeholders hash_seed SvREADONLY HvREHASH rehash_seed

All of these can probably be looked up in Perl's C API docs, but is there any Perl level documentation for them? Is the package stable? It's used by several core modules (Hash::Util for one), so I imagine it is, but the lack of documentation is a bit troubling.

I didn't see Internals.pm in the Perl distribution (different name maybe?), and it is not the Internals module up on CPAN.

Note: I fully understand that the functions in Internals:: are potentially dangerous, and I do not have any particular use in mind. I was reading through Hash::Util's source and came across it.

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

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

发布评论

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

评论(1

青春如此纠结 2024-09-11 03:20:59

IIRC 代码不是Internals.pm,而是libinternals.c。看起来它们曾经位于 Perl 5.8 中的universal.c 但已迁移出去。

根据 03/2009 和 Perl 5.10,它们没有按照此 perlmonks 线程进行记录。

另外,在同一个线程中, ysth 指出:

universal.c 中未记录的内容
不应该被依赖;他们应该
仅由核心模块使用。他们
没有故意记录,以允许
随时更改它们
但有必要。为了这些目的,
该代码是足够好的文档。

IIRC the code is not Internals.pm but libinternals.c. It looks like they used to be in universal.c in Perl 5.8 but got migrated out.

As per 03/2009 and Perl 5.10 they were not documented as per this perlmonks thread.

Also, in the same thread, ysth states:

Undocumented things in universal.c
should not be depended on; they should
only be used by core modules. They
aren't documented on purpose, to allow
them to be changed whenever and
however necessary. For those purposes,
the code is good enough documentation.

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