Perl 有类似 Java/PHP 文档的东西吗?
Perl 有 Perl 文档生成器吗?像 Java Docs 或 PHP Documenter 之类的东西?
Does Perl have a Perl Docs generator? Something like Java Docs or PHP Documenter?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
是的,它被称为 POD (以前:perldoc)
您只需在源代码中编写文档,就像使用 javadoc 一样。
简而言之,“=item”是项目符号项目,例如函数或参数“=over”下降一级标识,“=back”上升一级。在您想要切换回 Perl 代码的地方使用“=cut”。
下面是一个示例:
只需将 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:
Simply pass your perl code through the perldoc program to get the formatted documentation.
为什么,是的。是的,确实如此! Perldoc。
Why, yes. Yes, it does! Perldoc.
您是说 perldoc 吗?
另请参阅相关的 Stack Overflow 问题:
You mean perldoc?
Also see this related Stack Overflow quesion:
[仅针对 googlers] 正如人们已经说过的,您使用 POD 制作文档(不是注释,注释是针对维护人员的,pod 是针对用户文档的)。通常您在脚本或模块的开头和结尾以及每个方法之前添加 POD,然后您可以在控制台中使用
perldoc your_module
或pod2html
进行转换转换成 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, orpod2html
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.