Edited to add: The rest of this article is now mostly interesting if someone happens to stumble over the same symptoms, since the solution was indeed a messed-up setup of my system. It turned out that I had an activation of local::lib in my .bashrc, probably copied from an outdated backup of the previous desktop. After deleting the line eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)" from .bashrc everything works as it should. There is no problem with having XS libraries for multiple versions of Perl with perlbrew. Binaries from different verions of XS components end up in different directories, and if they are wrappers for system libraries like libreadline, then all of them resolve quite fine against same the system library.

Hi fellow monks,

One of the routine modules I'm installing in Perl is Term::ReadLine::Gnu, because without it I can't use arrow-up to browse through the history in the Perl debugger. I am on Debian Buster and I have libterm-readline-gnu-perl installed. Fine so far.

But I'm also using perlbrew, so I want to have the same module in my perlbrew environments. I have cpamn set up so it installs everything under ~/perl5, which works quite well, with the notable exception of Term::ReadLine::Gnu.

I couldn't just cpanm Term::ReadLine::Gnu because I need to have the readline headers. This did not surprise me too much since that happens with all Perl modules which are just wrappers around some system libs. So, I installed the Debian package libreadline-dev, and voila, cpanm Term::ReadLine::Gnu installs quite fine and works.

However, as soon as I switch the perl version (in that case from 5.30.0 to 5.22.1) to and enter the debugger, I get:

Loading DB routines from perl5db.pl version 1.49 Editor support available. Enter h or 'h h' for help, or 'man perldebug' for more help. main::(-e:1): 1 Cannot do `initialize' in Term::ReadLine::Gnu at /home/haj/perl5/perlb +rew/perls/perl-5.22.1/lib/5.22.1/perl5db.pl line 6840. at /home/haj/perl5/lib/perl5/x86_64-linux/Term/ReadLine/Gnu.pm line 8 +56. Term::ReadLine::Gnu::AU::AUTOLOAD(Term::ReadLine=HASH(0x5587e4 +eb29c0)) called at /home/haj/perl5/lib/perl5/x86_64-linux/Term/ReadLi +ne/Gnu.pm line 297 Term::ReadLine::Gnu::new("Term::ReadLine", "perldb", GLOB(0x55 +87e44ddd30), GLOB(0x5587e45cd218)) called at /home/haj/perl5/perlbrew +/perls/perl-5.22.1/lib/5.22.1/perl5db.pl line 6840 DB::setterm() called at /home/haj/perl5/perlbrew/perls/perl-5. +22.1/lib/5.22.1/perl5db.pl line 1832 DB::_DB__read_next_cmd(undef) called at /home/haj/perl5/perlbr +ew/perls/perl-5.22.1/lib/5.22.1/perl5db.pl line 2761 DB::DB called at -e line 1 Cannot do `initialize' in Term::ReadLine::Gnu at /home/haj/perl5/perlb +rew/perls/perl-5.22.1/lib/5.22.1/perl5db.pl line 6840. END failed--call queue aborted at -e line 8671. at -e line 8671.

However, under the 5.22.1, I can also install cpanm Term::ReadLine::Gnu, and from that time on, it works. Until I switch back to 5.30.1, where I get the same error.

Is there a way around this? I'd rather not re-install Term::ReadLine::Gnu every time I switch the Perl version...


In reply to SOLVED: How to install Term::ReadLine::Gnu in perlbrew ... only once? by haj

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.