Explicit setter for out_fh.

This commit is contained in:
Brian Fraser
2012-01-10 14:05:02 -03:00
parent ae76c73395
commit 93279a03da
2 changed files with 14 additions and 12 deletions

View File

@@ -156,24 +156,26 @@ sub set_interactive {
}
}
# What this method does is thee-fold:
# It sets or returns the currently set filehandle, kind of like a poor man's
# select(); but also, it checks whenever said filehandle is open. If it's not,
# it defaults to STDOUT.
# Checks whenever said filehandle is open. If it's not, defaults to STDOUT.
sub out_fh {
my ( $self, $new_fh ) = @_;
# ->opened comes from IO::Handle.
if ( $new_fh && ref($new_fh) && $new_fh->opened ) {
$self->{out_fh} = $new_fh;
}
my ( $self ) = @_;
if ( !$self->{out_fh} || !$self->{out_fh}->opened ) {
$self->{out_fh} = \*STDOUT;
}
return $self->{out_fh};
}
# It sets or returns the currently set filehandle, kind of like a poor man's
# select().
sub set_out_fh {
my ( $self, $new_fh ) = @_;
# ->opened comes from IO::Handle.
if ( $new_fh && ref($new_fh) && $new_fh->opened ) {
$self->{out_fh} = $new_fh;
}
}
sub column_regex {
my ( $self, $new_re ) = @_;
if ($new_re) {