Re: How to install Perl with readline support?

2016-03-12 Thread David Christensen

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
  53 63 72 69 70 74 20 73  74 61 72 74 65 64 20 6f  |Script 
started o|
0010  6e 20 53 61 74 20 4d 61  72 20 31 32 20 31 30 3a  |n Sat Mar 
12 10:|
0020  35 30 3a 35 34 20 32 30  31 36 0a 64 70 63 68 72  |50:54 
2016.dpchr|
0030  69 73 74 40 74 37 34 30  30 3a 7e 2f 73 61 6e 64 
|ist@t7400:~/sand|
0040  62 6f 78 2f 70 65 72 6c  24 20 70 65 72 6c 20 2d  |box/perl$ 
perl -|
0050  64 65 20 30 0d 0a 0d 0a  4c 6f 61 64 69 6e 67 20  |de 
0Loading |
0060  44 42 20 72 6f 75 74 69  6e 65 73 20 66 72 6f 6d  |DB routines 
from|
0070  20 70 65 72 6c 35 64 62  2e 70 6c 20 76 65 72 73  | perl5db.pl 
vers|
0080  69 6f 6e 20 31 2e 33 33  0d 0a 45 64 69 74 6f 72  |ion 
1.33..Editor|
0090  20 73 75 70 70 6f 72 74  20 61 76 61 69 6c 61 62  | support 
availab|
00a0  6c 65 2e 0d 0a 0d 0a 45  6e 74 65 72 20 68 20 6f 
|le.Enter h o|
00b0  72 20 60 68 20 68 27 20  66 6f 72 20 68 65 6c 70  |r `h h' for 
help|
00c0  2c 20 6f 72 20 60 6d 61  6e 20 70 65 72 6c 64 65  |, or `man 
perlde|
00d0  62 75 67 27 20 66 6f 72  20 6d 6f 72 65 20 68 65  |bug' for 
more he|
00e0  6c 70 2e 0d 0a 0d 0a 6d  61 69 6e 3a 3a 28 2d 65 
|lp.main::(-e|
00f0  3a 31 29 3a 09 30 0d 0a  20 20 20 20 20 20 20 20  |:1):.0.. 
 |
0100  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  | 
 |

*
0140  20 20 20 20 20 20 20 20  08 20 20 0d 0d 20 20 1b  |. 
..  .|
0150  5b 34 6d 44 42 3c 31 3e  1b 5b 32 34 6d 20 1b 5b 
|[4mDB<1>.[24m .[|
0160  31 6d 70 1b 5b 30 6d 1b  5b 31 6d 20 1b 5b 30 6d  |1mp.[0m.[1m 
.[0m|
0170  1b 5b 31 6d 31 1b 5b 30  6d 0d 0d 0a 31 0d 0a 20 
|.[1m1.[0m...1.. |
0180  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  | 
 |

*
01c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 08  | 
.|
01d0  20 20 0d 0d 20 20 1b 5b  34 6d 44 42 3c 32 3e 1b  |  .. 
.[4mDB<2>.|
01e0  5b 32 34 6d 20 1b 5b 31  6d 70 20 31 1b 5b 30 6d  |[24m .[1mp 
1.[0m|
01f0  0d 0d 0a 31 0d 0a 20 20  20 20 20 20 20 20 20 20  |...1.. 
 |
0200  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  | 
 |

*
0240  20 20 20 20 20 20 08 20  20 0d 0d 20 20 1b 5b 34  |  .  .. 
 .[4|
0250  6d 44 42 3c 33 3e 1b 5b  32 34 6d 20 1b 5b 31 6d  |mDB<3>.[24m 
.[1m|
0260  71 1b 5b 30 6d 0d 0d 0a  64 70 63 68 72 69 73 74 
|q.[0m...dpchrist|
0270  40 74 37 34 30 30 3a 7e  2f 73 61 6e 64 62 6f 78 
|@t7400:~/sandbox|
0280  2f 70 65 72 6c 24 20 65  78 69 74 0d 0a 65 78 69  |/perl$ 
exit..exi|
0290  74 0d 0a 0a 53 63 72 69  70 74 20 64 6f 6e 65 20  |t...Script 
done |
02a0  6f 6e 20 53 61 74 20 4d  61 72 20 31 32 20 31 30  |on Sat Mar 
12 10|

02b0  3a 35 31 3a 34 30 20 32  30 31 36 0a  |:51:40 2016.|
02bc




Re: How to install Perl with readline support?

2016-03-12 Thread Kynn Jones
On 3/12/16, David Christensen  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



Re: How to install Perl with readline support?

2016-03-12 Thread David Christensen

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



Re: How to install Perl with readline support?

2016-03-12 Thread David Christensen

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



Re: How to install Perl with readline support?

2016-03-12 Thread John L. Cunningham
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



How to install Perl with readline support?

2016-03-12 Thread Kynn Jones
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