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

时间:2022-02-01 23:15:33

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?

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

On my Windows machine, I've tried the following

在我的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 actually return information about the %ENV variable.

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

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

如果我不想通过成千上万的线路进行眼睛grep,我如何使用perldoc来找出%ENV?

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

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

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.

虽然我已经询问了%ENV,但这也适用于任何一般术语,因此在下一次我不知道哪个部分时,知道%ENV在perlvar中这个例子将无法帮助我。

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

有没有办法让perldoc转储所有东西(呃),我可以grep输出?

7 个解决方案

#1


4  

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.

perldoc没有在perlvar中搜索特定条目的选项(类似于-f for perlfunc)。常规搜索取决于您的寻呼机(在PAGER环境变量中指定)。就个人而言,我喜欢“少”。您可以从GnuWin32项目中获得更少的窗口。

#2


21  

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

查看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.

#3


2  

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.

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

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

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

#4


1  

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.

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

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.

随着您获得Perl的更多经验,您将知道在哪里查找文档。要知道,您可能需要引用perltoc,但过了一段时间,您将知道在perlfunc中查找函数,在perlvar中查找变量,等等。

You might also use my Perl documentation documentation.

您也可以使用我的Perl文档文档。

#5


0  

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

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

顺便说一下,自5.8.0以来已修复了许多错误。

#6


0  

  1. Install unixutils for Windows
  2. 安装适用于Windows的unixutils

  3. Call: perldoc perlvar | grep -A10 %env
  4. 致电:perldoc perlvar | grep -A10%env

#7


-1  

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:

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

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

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

#1


4  

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.

perldoc没有在perlvar中搜索特定条目的选项(类似于-f for perlfunc)。常规搜索取决于您的寻呼机(在PAGER环境变量中指定)。就个人而言,我喜欢“少”。您可以从GnuWin32项目中获得更少的窗口。

#2


21  

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

查看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.

#3


2  

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.

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

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

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

#4


1  

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.

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

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.

随着您获得Perl的更多经验,您将知道在哪里查找文档。要知道,您可能需要引用perltoc,但过了一段时间,您将知道在perlfunc中查找函数,在perlvar中查找变量,等等。

You might also use my Perl documentation documentation.

您也可以使用我的Perl文档文档。

#5


0  

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

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

顺便说一下,自5.8.0以来已修复了许多错误。

#6


0  

  1. Install unixutils for Windows
  2. 安装适用于Windows的unixutils

  3. Call: perldoc perlvar | grep -A10 %env
  4. 致电:perldoc perlvar | grep -A10%env

#7


-1  

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:

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

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

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