Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #165287 > unrolled thread

How to install Perl with readline support?

Started byKynn Jones <kynnjo@gmail.com>
First post2016-03-12 18:00 +0100
Last post2016-03-12 20:00 +0100
Articles 6 — 3 participants

Back to article view | Back to linux.debian.user


Contents

  How to install Perl with readline support? Kynn Jones <kynnjo@gmail.com> - 2016-03-12 18:00 +0100
    Re: How to install Perl with readline support? "John L. Cunningham" <djohngo@gmail.com> - 2016-03-12 18:10 +0100
      Re: How to install Perl with readline support? David Christensen <dpchrist@holgerdanske.com> - 2016-03-12 18:50 +0100
    Re: How to install Perl with readline support? David Christensen <dpchrist@holgerdanske.com> - 2016-03-12 18:40 +0100
      Re: How to install Perl with readline support? Kynn Jones <kynnjo@gmail.com> - 2016-03-12 19:50 +0100
        Re: How to install Perl with readline support? David Christensen <dpchrist@holgerdanske.com> - 2016-03-12 20:00 +0100

#165287 — How to install Perl with readline support?

FromKynn Jones <kynnjo@gmail.com>
Date2016-03-12 18:00 +0100
SubjectHow to install Perl with readline support?
Message-ID<rbV3s-BF-11@gated-at.bofh.it>
Hi everyone,

I have been searching for the answer to the subject line's question
for the last two hours.

None of the answers I've found work.  (I.e. the `perl -de 1` REPL
remains without readline support.)

I have already `apt-get install`-ed

    libreadline-dev
    libterm-readline-gnu-perl
    libterm-readline-perl-perl

(...along with their dependencies, of course).  I also ran `apt-get
install --reinstall perl`, and `dpkg-reconfigure`'d everything in
sight.  All of this got me nothing.

I'm puzzled by how difficult this problem has turned out to be.
Usually, `apt-cache search ...` followed by `apt-get install` takes
care of stuff like this.  In the harder cases, the first hit from a
Google search has the answer.  What makes this one so difficult?  Am I
missing something?

TIA!

kj

[toc] | [next] | [standalone]


#165289

From"John L. Cunningham" <djohngo@gmail.com>
Date2016-03-12 18:10 +0100
Message-ID<rbVd8-VK-15@gated-at.bofh.it>
In reply to#165287
On Sat, Mar 12, 2016 at 11:54:25AM -0500, Kynn Jones wrote:
> Hi everyone,
> 
> I have been searching for the answer to the subject line's question
> for the last two hours.
> 
> None of the answers I've found work.  (I.e. the `perl -de 1` REPL
> remains without readline support.)

I have to say that I usually just install perl modules from CPAN. It's too hard for me to match up the module that the perl error is complaining about with the correct debian package.

-- 
John

[toc] | [prev] | [next] | [standalone]


#165292

FromDavid Christensen <dpchrist@holgerdanske.com>
Date2016-03-12 18:50 +0100
Message-ID<rbVPQ-1dq-1@gated-at.bofh.it>
In reply to#165289
On 03/12/2016 09:06 AM, John L. Cunningham wrote:
> I have to say that I usually just install perl modules from CPAN.

I have found that installing foreign software (including CPAN 
distributions) is a good way to destabilize Debian systems.  So, I keep 
my most important machines "Debian clean", backup/archive religiously, 
and pick a specific machine (or dedicated VM) for non-Debian software 
experiments.


David

[toc] | [prev] | [next] | [standalone]


#165291

FromDavid Christensen <dpchrist@holgerdanske.com>
Date2016-03-12 18:40 +0100
Message-ID<rbVG9-19K-19@gated-at.bofh.it>
In reply to#165287
On 03/12/2016 08:54 AM, Kynn Jones wrote:
> I have been searching for the answer to the subject line's question
> for the last two hours.

On my Wheezy 7.9 box, Term::ReadLine is already installed.


RTFM Term::ReadLine, pasting the SYNOPSIS into a script, and running it:

     $ cat readline.pl
     use Term::ReadLine;
     my $term = Term::ReadLine->new('Simple Perl calc');
     my $prompt = "Enter your arithmetic expression: ";
     my $OUT = $term->OUT || \*STDOUT;
     while ( defined ($_ = $term->readline($prompt)) ) {
         my $res = eval($_);
         warn $@ if $@;
         print $OUT $res, "\n" unless $@;
         $term->addhistory($_) if /\S/;
     }

     $ perl readline.pl
     Enter your arithmetic expression: 1+1
     2
     Enter your arithmetic expression: ^[[A^C


History did not work on the second prompt.


 > I have [installed]
 >
 >      libreadline-dev
 >      libterm-readline-gnu-perl
 >      libterm-readline-perl-perl

RTFM Term::ReadLine indicates that a back end is needed. Either of the 
latter two you installed should be sufficient.


If I install:

     libterm-readline-perl-perl


And run the example again:

     $ perl readline.pl

     Enter your arithmetic expression: 1+1
     2

     Enter your arithmetic expression: 1+1
     2

     Enter your arithmetic expression:


History works, but there are extra blank lines between prompts and my 
terminal can get stuck in bold mode depending on how I exit (?).


David

[toc] | [prev] | [next] | [standalone]


#165298

FromKynn Jones <kynnjo@gmail.com>
Date2016-03-12 19:50 +0100
Message-ID<rbWLU-1YR-3@gated-at.bofh.it>
In reply to#165291
On 3/12/16, David Christensen <dpchrist@holgerdanske.com> wrote:
> If I install:
>
>      libterm-readline-perl-perl
>
>
> And run the example again:
>
>      $ perl readline.pl
>
>      Enter your arithmetic expression: 1+1
>      2
>
>      Enter your arithmetic expression: 1+1
>      2
>
>      Enter your arithmetic expression:
>
>
> History works, but there are extra blank lines between prompts and my
> terminal can get stuck in bold mode depending on how I exit (?).

Thanks.

What happens when you run

    % perl -de 0

    Loading DB routines from perl5db.pl version 1.44
    Editor support available.

    Enter h or 'h h' for help, or 'man perldebug' for more help.

    main::(-e:1):	0
      DB<1> p 1
    1
      DB<2>

...and then type UP-ARROW?

(When I do this, I get `^[[A`, and I also have installed
libterm-readline-perl-perl.)

kj

[toc] | [prev] | [next] | [standalone]


#165302

FromDavid Christensen <dpchrist@holgerdanske.com>
Date2016-03-12 20:00 +0100
Message-ID<rbWVA-23d-25@gated-at.bofh.it>
In reply to#165298
On 03/12/2016 10:48 AM, Kynn Jones wrote:
> What happens when you run
>
>      % perl -de 0
>
>      Loading DB routines from perl5db.pl version 1.44
>      Editor support available.
>
>      Enter h or 'h h' for help, or 'man perldebug' for more help.
>
>      main::(-e:1):	0
>        DB<1> p 1
>      1
>        DB<2>
>
> ...and then type UP-ARROW?

readline history works.


David



$ script
Script started, file is typescript
dpchrist@t7400:~/sandbox/perl$ perl -de 0

Loading DB routines from perl5db.pl version 1.33
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(-e:1):	0
 
            DB<1> p 1
1
 
            DB<2> p 1
1
 
            DB<3> q
dpchrist@t7400:~/sandbox/perl$ exit
exit
Script done, file is typescript

2016-03-12 10:51:40 dpchrist@t7400 ~/sandbox/perl
$ dump typescript
00000000  53 63 72 69 70 74 20 73  74 61 72 74 65 64 20 6f  |Script 
started o|
00000010  6e 20 53 61 74 20 4d 61  72 20 31 32 20 31 30 3a  |n Sat Mar 
12 10:|
00000020  35 30 3a 35 34 20 32 30  31 36 0a 64 70 63 68 72  |50:54 
2016.dpchr|
00000030  69 73 74 40 74 37 34 30  30 3a 7e 2f 73 61 6e 64 
|ist@t7400:~/sand|
00000040  62 6f 78 2f 70 65 72 6c  24 20 70 65 72 6c 20 2d  |box/perl$ 
perl -|
00000050  64 65 20 30 0d 0a 0d 0a  4c 6f 61 64 69 6e 67 20  |de 
0....Loading |
00000060  44 42 20 72 6f 75 74 69  6e 65 73 20 66 72 6f 6d  |DB routines 
from|
00000070  20 70 65 72 6c 35 64 62  2e 70 6c 20 76 65 72 73  | perl5db.pl 
vers|
00000080  69 6f 6e 20 31 2e 33 33  0d 0a 45 64 69 74 6f 72  |ion 
1.33..Editor|
00000090  20 73 75 70 70 6f 72 74  20 61 76 61 69 6c 61 62  | support 
availab|
000000a0  6c 65 2e 0d 0a 0d 0a 45  6e 74 65 72 20 68 20 6f 
|le.....Enter h o|
000000b0  72 20 60 68 20 68 27 20  66 6f 72 20 68 65 6c 70  |r `h h' for 
help|
000000c0  2c 20 6f 72 20 60 6d 61  6e 20 70 65 72 6c 64 65  |, or `man 
perlde|
000000d0  62 75 67 27 20 66 6f 72  20 6d 6f 72 65 20 68 65  |bug' for 
more he|
000000e0  6c 70 2e 0d 0a 0d 0a 6d  61 69 6e 3a 3a 28 2d 65 
|lp.....main::(-e|
000000f0  3a 31 29 3a 09 30 0d 0a  20 20 20 20 20 20 20 20  |:1):.0.. 
      |
00000100  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  | 
      |
*
00000140  20 20 20 20 20 20 20 20  08 20 20 0d 0d 20 20 1b  |        . 
..  .|
00000150  5b 34 6d 44 42 3c 31 3e  1b 5b 32 34 6d 20 1b 5b 
|[4mDB<1>.[24m .[|
00000160  31 6d 70 1b 5b 30 6d 1b  5b 31 6d 20 1b 5b 30 6d  |1mp.[0m.[1m 
.[0m|
00000170  1b 5b 31 6d 31 1b 5b 30  6d 0d 0d 0a 31 0d 0a 20 
|.[1m1.[0m...1.. |
00000180  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  | 
      |
*
000001c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 08  | 
     .|
000001d0  20 20 0d 0d 20 20 1b 5b  34 6d 44 42 3c 32 3e 1b  |  .. 
.[4mDB<2>.|
000001e0  5b 32 34 6d 20 1b 5b 31  6d 70 20 31 1b 5b 30 6d  |[24m .[1mp 
1.[0m|
000001f0  0d 0d 0a 31 0d 0a 20 20  20 20 20 20 20 20 20 20  |...1.. 
      |
00000200  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  | 
      |
*
00000240  20 20 20 20 20 20 08 20  20 0d 0d 20 20 1b 5b 34  |      .  .. 
  .[4|
00000250  6d 44 42 3c 33 3e 1b 5b  32 34 6d 20 1b 5b 31 6d  |mDB<3>.[24m 
.[1m|
00000260  71 1b 5b 30 6d 0d 0d 0a  64 70 63 68 72 69 73 74 
|q.[0m...dpchrist|
00000270  40 74 37 34 30 30 3a 7e  2f 73 61 6e 64 62 6f 78 
|@t7400:~/sandbox|
00000280  2f 70 65 72 6c 24 20 65  78 69 74 0d 0a 65 78 69  |/perl$ 
exit..exi|
00000290  74 0d 0a 0a 53 63 72 69  70 74 20 64 6f 6e 65 20  |t...Script 
done |
000002a0  6f 6e 20 53 61 74 20 4d  61 72 20 31 32 20 31 30  |on Sat Mar 
12 10|
000002b0  3a 35 31 3a 34 30 20 32  30 31 36 0a              |:51:40 2016.|
000002bc

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web