【问题标题】:Perl script Can't locate Text/Template.pm in @INC [duplicate]Perl 脚本在 @INC 中找不到 Text/Template.pm [重复]
【发布时间】:2015-11-20 16:55:44
【问题描述】:

我正在尝试调整用 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

很乐意为此提供解决方案。

【问题讨论】:

  • 您的脚本正在尝试导入模块Text::Template,但找不到它。这不是核心模块,因此您可能需要安装它。
  • 我已经安装了 text::Template 模块 /usr/local/cpanel/Cpanel/Template.pm /usr/local/cpanel/Cpanel/Exception/Template.pm /usr/local/cpanel /Cpanel/Exim/Config/Template.pm /usr/local/cpanel/Cpanel/ZoneFile/Template.pm /usr/local/cpanel/Whostmgr/Template.pm /usr/local/lib/perl5/site_perl/5.8.8 /HTML/Template.pm /usr/local/lib/perl5/site_perl/5.8.8/Net/OSCAR/XML/Template.pm /usr/local/lib/perl5/site_perl/5.8.8/x86_64-linux/Template .pm /usr/local/lib64/perl5/Template.pm /usr/local/share/perl5/Net/OSCAR/XML/Template.pm /usr/share/perl5/vendor_perl/HTML/Template.pm
  • @rishidadwal 我在那里看不到Text/Template.pm如何您是如何安装它的?

标签: mysql perl


【解决方案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

【讨论】:

  • 您好,感谢您的回复 /usr/local/cpanel/Cpanel/Template.pm /usr/local/cpanel/Cpanel/Exception/Template.pm /usr/local/cpanel/Cpanel/Exim/ Config/Template.pm /usr/local/cpanel/Cpanel/ZoneFile/Template.pm /usr/local/cpanel/Whostmgr/Template.pm /usr/local/lib/perl5/site_perl/5.8.8/HTML/Template。 pm /usr/local/lib/perl5/site_perl/5.8.8/Net/OSCAR/XML/Template.pm /usr/local/lib/perl5/site_perl/5.8.8/x86_64-linux/Template.pm /usr/ local/lib64/perl5/Template.pm /usr/local/share/perl5/Net/OSCAR/XML/Template.pm /usr/share/perl5/vendor_perl/HTML/Template.pm
【解决方案2】:

打开命令提示符。输入以下内容:

ppm install Text-Template

【讨论】:

  • ppm 是 Windows 上 ActivePerl 的包管理器。 OP 似乎可以在 linux 系统上运行。
猜你喜欢
  • 1970-01-01
  • 2017-11-21
  • 2020-07-15
  • 2013-11-14
  • 1970-01-01
  • 2012-06-23
  • 1970-01-01
  • 2020-11-07
  • 1970-01-01
相关资源
最近更新 更多