Skip to content

Commit

Permalink
add -p: import Term::ReadKey with 'require'
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Rast authored and Junio C Hamano committed Feb 7, 2009
1 parent a301973 commit 748aa68
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion git-add--interactive.perl
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@
my $normal_color = $repo->get_color("", "reset");

my $use_readkey = 0;
sub ReadMode;
sub ReadKey;
if ($repo->config_bool("interactive.singlekey")) {
eval {
use Term::ReadKey;
require Term::ReadKey;
Term::ReadKey->import;
$use_readkey = 1;
};
}
Expand Down

0 comments on commit 748aa68

Please sign in to comment.