Perl não pode encontrar o módulo XML / simples

2

Eu estou tentando executar um script Perl no Ubuntu 14.04.02 LTS. O script é assim:

#!/usr/bin/perl5.18.2

use warnings;
use strict;

use XML::Simple qw(:strict);
use Net::Telnet();

Eu obtenho o seguinte na linha de comando:

Can't locate XML/Simple.pm in @INC (you may need to install the XML::Simple module)
(@INC contains: /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 .)
at RR_2_668.pl line 16.
BEGIN failed--compilation aborted at RR_2_668.pl line 16.

O XML :: Simple está na linha 16. Eu removi todas as linhas de comentário entre e removi o código de adição depois para breve. Eu fiz uma pesquisa e o Simple.pm parece estar no sistema:

/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

Existe uma maneira de fazer o meu script ver um desses?

    
por xBACP 18.11.2016 / 16:08

1 resposta

3

Todos os arquivos Simple.pm que você encontrou pertencem a outras bibliotecas Perl. Nenhum deles faz o que você quer. Você encontrou

IPC::System::Simple
Lintian::Command::Simple
Log::Message::Simple
Locale::Maketext::Simple
Pod::Simple
Test::Simple
Filter::Simple
Log::Message::Simple

Para encontrar o caminho certo, você deve fazer apt-cache search XML::Simple e escolher um pacote para instalar com sudo apt-get install <insert your choice> .

No meu Ubuntu 16.04 (YMMV), mostra-me:

$ 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
    
por waltinator 18.11.2016 / 16:36