diff --git a/lib/Diskstats.pm b/lib/Diskstats.pm index 69dbf78a..ffc018c7 100644 --- a/lib/Diskstats.pm +++ b/lib/Diskstats.pm @@ -123,13 +123,15 @@ sub set_first_ts { } sub filter_zeroed_rows { - my ($self, $new_val) = @_; - if ( defined($new_val) ) { - $self->{filter_zeroed_rows} = $new_val; - } + my ($self) = @_; return $self->{filter_zeroed_rows}; } +sub set_filter_zeroed_rows { + my ($self, $new_val) = @_; + $self->{filter_zeroed_rows} = $new_val; +} + sub sample_time { my ($self, $new_val) = @_; if (defined($new_val)) { diff --git a/lib/DiskstatsMenu.pm b/lib/DiskstatsMenu.pm index 04bec396..a422ec8a 100644 --- a/lib/DiskstatsMenu.pm +++ b/lib/DiskstatsMenu.pm @@ -371,7 +371,7 @@ sub hide_inactive_disks { # Eeep. In OptionParser, "true" means show; in Diskstats, "true" means hide. # Thus !$new_val for OptionParser $args{options}->{OptionParser}->set('zero-rows', !$new_val); - $args{options}->{current_group_by_obj}->filter_zeroed_rows($new_val); + $args{options}->{current_group_by_obj}->set_filter_zeroed_rows($new_val); return; } diff --git a/t/lib/Diskstats.t b/t/lib/Diskstats.t index 4d7e4bb8..9033e4a5 100644 --- a/t/lib/Diskstats.t +++ b/t/lib/Diskstats.t @@ -221,7 +221,7 @@ is_deeply( "...And clears the internal duplicate-checking list" ); -$obj->filter_zeroed_rows(1); +$obj->set_filter_zeroed_rows(1); my $print_output = output( sub { $obj->print_rows( @@ -231,7 +231,7 @@ my $print_output = output( ); } ); -$obj->filter_zeroed_rows(0); +$obj->set_filter_zeroed_rows(0); is( $print_output,