Explicit setter for interactive.

This commit is contained in:
Brian Fraser
2012-01-10 14:01:11 -03:00
parent 79bdf3f1d3
commit ae76c73395
4 changed files with 10 additions and 6 deletions

View File

@@ -145,11 +145,15 @@ sub set_sample_time {
}
sub interactive {
my ($self) = @_;
return $self->{interactive};
}
sub set_interactive {
my ($self, $new_val) = @_;
if (defined($new_val)) {
$self->{interactive} = $new_val;
}
return $self->{interactive};
}
# What this method does is thee-fold:

View File

@@ -35,7 +35,7 @@ sub group_by_all {
$self->clear_state();
if (!$self->interactive) {
if (!$self->interactive()) {
$self->parse_from(
sample_callback => sub {
$self->print_deltas(

View File

@@ -88,7 +88,7 @@ sub group_by_disk {
data => $args{data},
);
if ($self->interactive) {
if ($self->interactive()) {
if ($self->{_iterations} == -1 && defined($original_offset)
&& eof($args{filehandle})) {
$self->clear_state;

View File

@@ -266,10 +266,10 @@ sub group_by {
# Just aliasing this for a bit.
for my $obj ( $args{options}->{current_group_by_obj} ) {
if ( $obj->isa("DiskstatsGroupBySample") ) {
$obj->interactive(1);
$obj->set_interactive(1);
}
else {
$obj->interactive(0);
$obj->set_interactive(0);
}
$obj->group_by(
filehandle => $args{filehandle},
@@ -283,7 +283,7 @@ sub group_by {
};
}->(),
);
$obj->interactive(1);
$obj->set_interactive(1);
$obj->{_print_header} = 0;
}
}