From: Dagfinn Ilmari Mannsåker Date: Sat, 29 Aug 2015 19:09:38 +0000 (+0100) Subject: Simplify debugfh rebuilding after clearing X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=957f6ffec741bcf81297f996ca5cbebba29852c5;p=dbsrgits%2FDBIx-Class.git Simplify debugfh rebuilding after clearing --- diff --git a/lib/DBIx/Class/Storage/Statistics.pm b/lib/DBIx/Class/Storage/Statistics.pm index 42137bf..f521658 100644 --- a/lib/DBIx/Class/Storage/Statistics.pm +++ b/lib/DBIx/Class/Storage/Statistics.pm @@ -45,20 +45,11 @@ already set). =cut -# FIXME - there ought to be a way to fold this into _debugfh itself -# having the undef re-trigger the builder (or better yet a default -# which can be folded in as a qsub) -sub debugfh { - my $self = shift; - - return $self->_debugfh(@_) if @_; - $self->_debugfh || $self->_build_debugfh; -} - -has _debugfh => ( +has debugfh => ( is => 'rw', lazy => 1, - trigger => qsub '$_[0]->_defaulted_to_stderr(undef)', + trigger => qsub '$_[0]->_defaulted_to_stderr(undef); $_[0]->_clear_debugfh unless $_[1];', + clearer => '_clear_debugfh', builder => '_build_debugfh', );