如何使用 perldoc 查找 %ENV 变量?

发布于 2024-07-04 22:35:06 字数 669 浏览 14 评论 0原文

我通过阅读 perldoc perlvar 发现,大约有一千行是对 %ENV 的帮助。 有没有办法直接从命令行找到它?

在我的 Windows 计算机上,我尝试了以下

perldoc ENV
perldoc %ENV
perldoc %%ENV
perldoc -r ENV (returns info about Use Env)
perldoc -r %ENV
perldoc -r %%%ENV
perldoc -r %%%%ENV (says No documentation found for "%ENV")

None 实际上返回有关 %ENV 变量的信息。

如果我不想通过数千行进行eye-grep,如何使用 perldoc 来查找 %ENV?

我尝试了建议的“perldoc perlvar”,然后输入 /%ENV,但没有任何反应。

perl -v: This is perl, v5.8.0 built for MSWin32-x86-multi-thread

虽然我已经询问过 %ENV,但这也适用于任何通用术语,因此知道 %ENV 在这个示例的 perlvar 中对我下次不知道哪个部分时不会有帮助。

有没有办法让 perldoc 转储所有内容(呃)并且我可以 grep 输出?

I find from reading perldoc perlvar, about a thousand lines in is help for %ENV. Is there a way to find that from the command line directly?

On my Windows machine, I've tried the following

perldoc ENV
perldoc %ENV
perldoc %%ENV
perldoc -r ENV (returns info about Use Env)
perldoc -r %ENV
perldoc -r %%%ENV
perldoc -r %%%%ENV (says No documentation found for "%ENV")

None actually return information about the %ENV variable.

How do I use perldoc to find out about %ENV, if I don't want to have to eye-grep through thousands of line?

I've tried the suggested "perldoc perlvar" and then typing /%ENV, but nothing happens.

perl -v: This is perl, v5.8.0 built for MSWin32-x86-multi-thread

Though I've asked about %ENV, this also applies to any general term, so knowing that %ENV is in perlvar for this one example won't help me next time when I don't know which section.

Is there a way to get perldoc to dump everything (ugh) and I can grep the output?

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

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

发布评论

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

评论(7

淡忘如思 2024-07-11 22:35:08
  1. 安装用于 Windows 调用的 unixutils

  2. perldoc perlvar | perldoc grep -A10 %env
  1. Install unixutils for Windows
  2. Call:
    perldoc perlvar | grep -A10 %env
执妄 2024-07-11 22:35:08

如果您想查看 %ENV 的内容,可以使用 Data::Dumper 以相当可读的格式打印出来:

perl -MData::Dumper -e 'print Dumper \%ENV'

If you'd like to see the contents of your %ENV, you can use Data::Dumper to print it out in a rather readable format:

perl -MData::Dumper -e 'print Dumper \%ENV'

虫児飞 2024-07-11 22:35:07

我在本地使用 Apache::Perldoc (旧的,但仍然有效)机器浏览本地文档。 如果我有网络访问权限,我只需查看 perldoc.perl.org 并搜索。 但是,在这种情况下,搜索对变量没有用,最好使用特殊变量 链接位于页面左侧。

随着您获得更多 Perl 经验,您就会知道在哪里可以找到文档。 要知道,您可能必须参考 perltoc,但过了一会儿您就会知道在 perlfunc 中查找函数perlvar 中的变量,等等。

您还可以使用我的 Perl 文档

I use Apache::Perldoc (old, but still does its job) on my local machine to browse the local documentation. If I have net access though, I just look at perldoc.perl.org and search. However, in this case, search isn't useful for the variables and it's better to use the Special variables link at the left of the page.

As you get more experience with Perl, you'll know where to look for the documentation. For know, you might have to refer to perltoc, but after awhile you'll know to look for functions in perlfunc, variables in perlvar, and so on.

You might also use my Perl documentation documentation.

从来不烧饼 2024-07-11 22:35:07

perldoc 没有在 perlvar 中搜索特定条目的选项(就像 -f 对 perlfunc 所做的那样)。 一般搜索取决于您的寻呼机(在 PAGER 环境变量中指定)。 就我个人而言,我喜欢“少”。 您可以从less for windows获取.sourceforge.net/" rel="nofollow noreferrer">GnuWin32 项目。

perldoc doesn't have an option to search for a particular entry in perlvar (like -f does for perlfunc). General searching is dependent on your pager (specified in the PAGER environment variable). Personally, I like "less." You can get less for windows from the GnuWin32 project.

稚然 2024-07-11 22:35:07

搜索 %ENV 是名为“less”的寻呼机的一个功能,而不是 perldoc 的功能。 因此,如果 perldoc 使用不同的寻呼机,这可能不起作用。

Activestate Perl 附带 HTML 文档,您可以在浏览器中打开 perlvar,按 Ctrl+f 并输入 %ENV,然后按 Enter。

The searching for %ENV is a feature of the pager named 'less', not of perldoc. So if perldoc uses a different pager, this might not work.

Activestate Perl comes with HTML documentation, you can open perlvar in your browser, hit Ctrl+f and type %ENV, then hit enter.

七度光 2024-07-11 22:35:07
firefox http://perldoc.perl.org/perlvar.html#%ENV

顺便说一句,自 5.8.0 以来,许多错误已得到修复。

firefox http://perldoc.perl.org/perlvar.html#%ENV

By the way, many many many bugs have been fixed since 5.8.0.

太阳公公是暖光 2024-07-11 22:35:06

查看 Pod::Perldoc 的最新开发版本。 我提交了一个补丁,可以让你这样做:

$ perldoc -v '%ENV'

%ENV
$ENV{expr}
The hash %ENV contains your current environment. Setting a value in
"ENV" changes the environment for any child processes you subsequently
fork() off.

Check out the latest development version of Pod::Perldoc. I submitted a patch which lets you do this:

$ perldoc -v '%ENV'

%ENV
$ENV{expr}
The hash %ENV contains your current environment. Setting a value in
"ENV" changes the environment for any child processes you subsequently
fork() off.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文