1

perl -e 'use XML::Simple"

And get error "Can't locate XML/Simple.pm"

Then I installed XML:: Simple or Xml::Simple using

sudo perl -MCPAN -e 'install XML::Simple'

I also did this

sudo apt-get install libxml-simple-perl

still I have same error

Can't locate XML/Simple.pm in @INC (you may need to install the XML::Simple module) (@INC contains: /home/avrajit/anaconda3/lib/perl5/site_perl/5.22.2/x86_64-linux-thread-multi /home/avrajit/anaconda3/lib/perl5/site_perl/5.22.2 /home/avrajit/anaconda3/lib/perl5/5.22.2/x86_64-linux-thread-multi /home/avrajit/anaconda3/lib/perl5/5.22.2 .) at -e line 1. BEGIN failed--compilation aborted at -e line 1

I did this also apt-cache search XML::Simple

and output below

libxml-simple-perl - Perl module for reading and writing XML libdata-validate-struct-perl - module to validate recursive hash structures 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-hash-lx-perl - module to convert hash to xml and vice versa using LibXML 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 libxml-struct-perl - represent XML as data structure preserving element order libxml-structured-perl - module to convert XML data into a predefined Perl data structure and back ruby-xml-simple - Simple Ruby API for reading and writing XML

what to do now?

jit c
  • 33
  • 1
  • 7

1 Answers1

3

If you read error message, it lists directories that are searched for modules:

  • /home/avrajit/anaconda3/lib/perl5/site_perl/5.22.2/x86_64-linux-thread-multi
  • /home/avrajit/anaconda3/lib/perl5/site_perl/5.22.2
  • /home/avrajit/anaconda3/lib/perl5/5.22.2/x86_64-linux-thread-multi
  • /home/avrajit/anaconda3/lib/perl5/5.22.2
  • .

None of those directories are standard paths, so I assume that you have two Perl installations, and you have installed XML::Simple in one installation, whereas running perl -e 'use XML::Simple" invokes the second one. You can check that by running which perl.


BTW. XML::Simple is bad. Use XML::LibXML or XML::Twig instead.