Perl脚本无法在@INC中找到Text / Template.pm

时间:2015-11-20 07:51:53

标签: mysql perl

我正在尝试调整用Perl编写的MySQL调优器脚本。但是得到以下错误:

root@server2 [/tmp]# perl mysqltuner.pl
Can't locate Text/Template.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at mysqltuner.pl line 2816.
BEGIN failed--compilation aborted at mysqltuner.pl line 2816 (#1)
    (F) You said to do (or require, or use) a file that couldn't be
    found. Perl looks for the file in all the locations mentioned in @INC,
    unless the file name included the full path to the file.  Perhaps you
    need to set the PERL5LIB or PERL5OPT environment variable to say where
    the extra library is, or maybe the script needs to add the library name
    to @INC.  Or maybe you just misspelled the name of the file.  See
    perlfunc/require and lib.

Uncaught exception from user code:
        Can't locate Text/Template.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at mysqltuner.pl line 2816.
BEGIN failed--compilation aborted at mysqltuner.pl line 2816.
 at mysqltuner.pl line 2816

很高兴为此提供解决方案。

2 个答案:

答案 0 :(得分:1)

在您的perl脚本mysqltuner.pl中,您使用的是未安装在系统中的模块Text::Template,这就是您收到此警告的原因。 您可以使用cpan安装它。如果您使用的是Linux系统,请打开终端并键入:

sudo cpan install Text::Template #sudo is not required if you have login as root.

如果您使用的是Windows系统并使用ActivePerl,请使用以下命令:

ppm install Text-Template

答案 1 :(得分:0)

打开Command Promt。输入以下内容:

ppm install Text-Template