diff options
author | Karl Berry <karl@freefriends.org> | 2014-04-23 21:46:20 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-04-23 21:46:20 +0000 |
commit | 300c1eb6d37d46078d448d6d58938d5a80cd68ff (patch) | |
tree | 23a0a8b9f8f5460b405119c4d3c163d2d488ca5e /Master/tlpkg/tlperl/lib/CPANPLUS/Shell/Classic.pm | |
parent | ed55d86b7c5e18f6eccce80a1fb1423ca40a23b5 (diff) |
(tl)perl 5.18.2 for windows from siep
git-svn-id: svn://tug.org/texlive/trunk@33648 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl/lib/CPANPLUS/Shell/Classic.pm')
-rw-r--r-- | Master/tlpkg/tlperl/lib/CPANPLUS/Shell/Classic.pm | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/Master/tlpkg/tlperl/lib/CPANPLUS/Shell/Classic.pm b/Master/tlpkg/tlperl/lib/CPANPLUS/Shell/Classic.pm index 089d3de16bd..6cdc6f69cca 100644 --- a/Master/tlpkg/tlperl/lib/CPANPLUS/Shell/Classic.pm +++ b/Master/tlpkg/tlperl/lib/CPANPLUS/Shell/Classic.pm @@ -5,6 +5,7 @@ ################################################## package CPANPLUS::Shell::Classic; +use deprecate; use strict; @@ -30,7 +31,7 @@ $Params::Check::ALLOW_UNKNOWN = 1; BEGIN { use vars qw[ $VERSION @ISA ]; @ISA = qw[ CPANPLUS::Shell::_Base::ReadLine ]; - $VERSION = '0.0562'; + $VERSION = "0.9135"; } load CPANPLUS::Shell; @@ -97,6 +98,20 @@ sub new { code => \&__ask_about_test_report, ); + if (my $histfile = $self->configure_object->get_conf( 'histfile' )) { + my $term = $self->term; + if ($term->can('AddHistory')) { + if (open my $fh, '<', $histfile) { + local $/ = "\n"; + while (my $line = <$fh>) { + chomp($line); + $term->AddHistory($line); + } + close($fh); + } + } + } + return $self; } @@ -194,6 +209,24 @@ sub _dispatch_on_input { ### displays quit message sub _quit { + my $self = shift; + my $term = $self->term; + + if ($term->can('GetHistory')) { + my @history = $term->GetHistory; + + my $histfile = $self->configure_object->get_conf('histfile'); + + if (open my $fh, '>', $histfile) { + foreach my $line (@history) { + print {$fh} "$line\n"; + } + close($fh); + } + else { + warn "Cannot open history file '$histfile' - $!"; + } + } ### well, that's what CPAN.pm says... print "Lockfile removed\n"; |