2

I am immersing myself into the world of Perl for the first time. I figured the easiest way was to integrate using notepad++, which is my preferred editor. I went ahead and installed the ActiveState self extracting installer. I then pointed NppExec to my perl directory by typing:

perl "$(FULL_CURRENT_PATH)"

As a script "Run Perl", saved, then added a macro using this procedure

http://paul.atc.informatica.gsf.nl/resources/Perl_with_Notepad.pdf

I can run Perl scripts using the perl compiler. However, perldoc does not work erroring with:

Can't locate object method "perldoc" via package "perldoc" (perhaps you forgot to load "perldoc"?) at C:\Users...

This is because my perldoc and compiler are actually in c:\perl\bin (or whatever)

How do I switch the file path to point to the right directory? Thank you so much. I am a complete noob at this.

Edit: To add more information, perldoc works fine if i call

perldoc perldoc

using the command prompt. It does not work when i write a script in notepad++ and attempt to complile. Both the cmd prompt and notepad++ will compile scripts correctly.

4

1 回答 1

3

Perldoc 不是 Perl 语言的一部分。它是一个程序,是核心发行版的一部分。如果您寻找它,您可能会在 ActivePerl 安装中找到 perldoc.bat。

所以这就是为什么:

 perldoc perldoc

从命令行工作(因为这就是它的意图被调用的方式。但是当你要求 Perl 执行“perldoc”命令时失败了。它勇敢地尝试找到一个方法,定义在所有包含的模块中的某个地方,但没有找到,告诉你。

所以如果你想写一个 Perl 程序来执行 perldoc,你可以使用这样的东西:

  print `perldoc perldoc`

但是你最好使用 bat 文件,或者在你的 windows 版本中使用它的等效文件。

于 2013-06-24T21:16:44.940 回答