add -p: import Term::ReadKey with 'require'
eval{use...} is no good because the 'use' is evaluated at compile time, so manually 'require' it. We need to forward declare the functions we use, otherwise Perl raises a compilation error. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Thomas Rast committed
Feb 6, 2009 at 20:30 UTC
748aa689bac2c1dd5d902815b0dec6364d20bf34
1 file changed
+4
-1
git-add--interactive.perl
+4
-1
@@ -40,9 +40,12 @@ my ($diff_new_color) =
40
my $normal_color = $repo->get_color("", "reset");
41
42
my $use_readkey = 0;
43
+sub ReadMode;
44
+sub ReadKey;
45
if ($repo->config_bool("interactive.singlekey")) {
46
eval {
45
- use Term::ReadKey;
47
+ require Term::ReadKey;
48
+ Term::ReadKey->import;
49
$use_readkey = 1;
50
};
51
}