On Sep 18, 12:49 pm, Packy Anderson <
packyander...@gmail.com> wrote:
> I'm using the single-file 1.90 running out of my $HOME/bin. Unfortunately,
> it's not using the pager. I'll ack for some common string in my codebase,
> and the results scroll off the screen. I could swear it was working before
> I upgraded to 1.90...
I found the problem. Somewhere leading up to v1.90, ack switched over
from having a $to_screen package variable to having a $output_to_pipe
variable that reversed the sense of the test, but the code in
set_up_pager() didn't similarly reverse the sense. So, while the
older code had:
sub set_up_pager {
my $command = shift;
return unless $to_screen;
# set up the pager
}
Version 1.90 had:
sub set_up_pager {
my $command = shift;
return unless App::Ack::output_to_pipe();
# set up the pager
}
This is easily fixed by switching the unless to an if:
$ git diff
diff --git a/Ack.pm b/Ack.pm
index ae43146..260482e 100644
--- a/Ack.pm
+++ b/Ack.pm
@@ -1476,7 +1476,7 @@ sub get_iterator {
sub set_up_pager {
my $command = shift;
- return unless App::Ack::output_to_pipe();
+ return if App::Ack::output_to_pipe();
my $pager;
if ( not open( $pager, '|-', $command ) ) {
diff --git a/ack b/ack
index 239bcaa..78e8cec 100755
--- a/ack
+++ b/ack
@@ -2319,7 +2319,7 @@ sub get_iterator {
sub set_up_pager {
my $command = shift;
- return unless App::Ack::output_to_pipe();
+ return if App::Ack::output_to_pipe();
my $pager;
if ( not open( $pager, '|-', $command ) ) {
And now the pager works.
Later!
-packy