Perl 有类似 Java/PHP 文档的东西吗?

发布于 2024-08-19 03:15:39 字数 61 浏览 3 评论 0原文

Perl 有 Perl 文档生成器吗?像 Java Docs 或 PHP Documenter 之类的东西?

Does Perl have a Perl Docs generator? Something like Java Docs or PHP Documenter?

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

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

发布评论

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

评论(4

欢烬 2024-08-26 03:15:39

是的,它被称为 POD (以前:perldoc)

您只需在源代码中编写文档,就像使用 javadoc 一样。

简而言之,“=item”是项目符号项目,例如函数或参数“=over”下降一级标识,“=back”上升一级。在您想要切换回 Perl 代码的地方使用“=cut”。

下面是一个示例:

=item $b->add_module ( %options )

Initialize a module. A module is a repository or a branch of a repository.
Valid options are

=over

=item id

Id of this module

=item repo

Url of repository. Currently only subversion repositories are supported.

=back

=cut
sub add_module($%)
{

只需将 Perl 代码传递给 perldoc 程序即可获取格式化文档。

Yes, it's called POD (formerly: perldoc)

You simply write documentation in the source, just like with javadoc.

Briefly, "=item" is a bulleted item, e.g. a function or a parameter "=over" goes down a level of identation, "=back" goes up a level. Use "=cut" where you want to switch back to perl code.

Here is an example of what it could look like:

=item $b->add_module ( %options )

Initialize a module. A module is a repository or a branch of a repository.
Valid options are

=over

=item id

Id of this module

=item repo

Url of repository. Currently only subversion repositories are supported.

=back

=cut
sub add_module($%)
{

Simply pass your perl code through the perldoc program to get the formatted documentation.

橙幽之幻 2024-08-26 03:15:39

为什么,是的。是的,确实如此! Perldoc

Why, yes. Yes, it does! Perldoc.

战皆罪 2024-08-26 03:15:39

您是说 perldoc 吗?

另请参阅相关的 Stack Overflow 问题:

You mean perldoc?

Also see this related Stack Overflow quesion:

梦里人 2024-08-26 03:15:39

[仅针对 googlers] 正如人们已经说过的,您使用 POD 制作文档(不是注释,注释是针对维护人员的,pod 是针对用户文档的)。通常您在脚本或模块的开头和结尾以及每个方法之前添加 POD,然后您可以在控制台中使用 perldoc your_modulepod2html 进行转换转换成 html 并在服务器中浏览,或者使用 pdoc (它有点旧,但是当您想要一个网络文档导航器并链接到网络中的代码)。

有一个关于格式化 Pod 的新问题,您可能也会感兴趣
perl-documentation-pod-browsers

和这个 如何-can-i-generate-html-documentation-for-perl-code-comments

还有一个正在谈论做一个 pod2html 并使用 css 文件来模仿 cpansearch 页面,但我现在找不到它。

[just for googlers] As people already said, you make documentation with POD (not comments, comments are for maintainers, pod for user documentation). Usually you add your POD at the start and end of your script or module, and before each method), then you can use perldoc your_module in the console, or pod2html to convert to html and browse in a server, or use pdoc (it is a bit old but is very helpful when you want to have a web doc navigator and links to the code in the web).

there is a newer question about formatting the pod that could be also of your interest
perl-documentation-pod-browsers

and this one how-can-i-generate-html-documentation-for-perl-code-comments

And there was another one talking about to do a pod2html and using a css file to mimic the cpansearch pages, but I can not find it now.

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