Changeset 3698

Show
Ignore:
Timestamp:
12/28/07 11:23:39 (13 months ago)
Author:
tokuhirom
Message:

r3645@mnk (orig r295): tokuhiro | 2007-03-01 07:20:44 -0800
work with Term::ReadLine::Perl.thanks for franck and mizzy.


http://back-paper.labs.mfac.jp/show?paper_rid=ns6J9fFl6S


Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Archer/lib/Archer/Shell.pm

    r3690 r3698  
    2020    my $HISTSIZE = 256; 
    2121 
    22     $term->stifle_history($HISTSIZE); 
    23     if (-f $HISTFILE) { 
    24         $term->ReadHistory($HISTFILE) or $self->{context}->log('warn' => "cannot read history file: $!"); 
    25     } 
     22        # this won't work with Term::ReadLine::Perl 
     23        # If there is Term::ReadLine::Gnu, be sure to do : export "PERL_RL=Gnu o=0" 
     24        eval { $term->stifle_history($HISTSIZE);}; 
     25         
     26        if (@!){ 
     27                $self->{context}->log('debug' => "You will need Term::ReadLine::Gnu"); 
     28        }else{ 
     29        if (-f $HISTFILE) { 
     30                $term->ReadHistory($HISTFILE) or $self->{context}->log('warn' => "cannot read history file: $!"); 
     31        } 
     32        } 
    2633 
    2734    while ( defined( my $line = $term->readline('archer> ') )) { 
     
    3239    print "\n"; 
    3340 
    34     $term->WriteHistory($HISTFILE) or $self->{context}->log('warn' => "perlsh: cannot write history file: $!"); 
     41        eval {$term->WriteHistory($HISTFILE);}; 
     42        if (@!){ 
     43                $self->{context}->log('debug' => "perlsh: cannot write history file: $!"); 
     44        } 
     45 
    3546} 
    3647