Perl 找不到模块 XML/简单

xBA*_*ACP 2 perl 14.04

我试图在 Ubuntu 14.04.02 LTS 上运行 Perl 脚本。该脚本如下所示:

#!/usr/bin/perl5.18.2

use warnings;
use strict;

use XML::Simple qw(:strict);
use Net::Telnet();
Run Code Online (Sandbox Code Playgroud)

我在命令行上得到以下信息:

在@INC 中找不到 XML/Simple.pm(您可能需要安装 XML::Simple 模块)
(@INC 包含:/usr/share/perl5/ /etc/perl 
/usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 
/usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .)
在 RR_2_668.pl 第 16 行。
BEGIN 失败——编译在 RR_2_668.pl 第 16 行中止。

XML::Simple 位于第 16 行。为简洁起见,我删除了中间的所有注释行并删除了后面的附加代码。我进行了搜索,Simple.pm 似乎在系统上:

/usr/share/perl5/IPC/System/Simple.pm
/usr/share/perl5/Lintian/Command/Simple.pm
/usr/share/perl5/Log/Message/Simple.pm
/usr/share/perl/5.18.2/Locale/Maketext/Simple.pm
/usr/share/perl/5.18.2/Pod/Simple.pm
/usr/share/perl/5.18.2/Test/Simple.pm
/usr/share/perl/5.18.2/Filter/Simple.pm
/usr/share/perl/5.18.2/Log/Message/Simple.pm

有没有办法让我的脚本看到其中一个?

wal*_*tor 5

Simple.pm您找到的所有文件都属于其他 Perl 库。他们都没有做你想做的。你找到了

IPC::System::Simple
Lintian::Command::Simple
Log::Message::Simple
Locale::Maketext::Simple
Pod::Simple
Test::Simple
Filter::Simple
Log::Message::Simple
Run Code Online (Sandbox Code Playgroud)

要找到正确的,你应该做apt-cache search XML::Simple并选择一个包来安装sudo apt-get install <insert your choice>

在我的 Ubuntu 16.04 (YMMV) 上,它显示了我:

$ apt-cache search XML::Simple
libxml-simple-perl - Perl module for reading and writing XML
libdns-zoneparse-perl - Perl extension for parsing and manipulating DNS Zone Files
libgtk2-gladexml-simple-perl - clean object-oriented perl interface to Gtk2::GladeXML
libtemplate-plugin-xml-perl - XML plugins for the Template Toolkit
libtest-xml-simple-perl - Perl testing framework for XML data
libxml-libxml-simple-perl - Perl module that uses the XML::LibXML parser for XML structures
libxml-opml-simplegen-perl - module for creating OPML using XML::Simple
libxml-simpleobject-enhanced-perl - Perl module which enhances libxml-simpleobject-perl
libxml-simpleobject-libxml-perl - Simple oo representation of an XML::LibXML DOM object
libxml-simpleobject-perl - Objectoriented Perl interface to a parsed XML::Parser tree
ruby-xml-simple - Simple Ruby API for reading and writing XML
libxml-hash-lx-perl - module to convert hash to xml and vice versa using LibXML
libxml-struct-perl - represent XML as data structure preserving element order
libxml-structured-perl - Convert XML data into a predefined Perl data structure and back
Run Code Online (Sandbox Code Playgroud)