summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/CPANPLUS/Shell/Classic.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlperl/lib/CPANPLUS/Shell/Classic.pm')
-rw-r--r--Master/tlpkg/tlperl/lib/CPANPLUS/Shell/Classic.pm35
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";