From: Arthur Axel "fREW" Schmidt Date: Sat, 23 Oct 2010 20:41:46 +0000 (+0000) Subject: allow disabling of show_progress; _ some accessors X-Git-Tag: v1.70~22 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a2b743ce05a705f3795376649b2511601a92ca55;p=dbsrgits%2FSQL-Abstract.git allow disabling of show_progress; _ some accessors --- diff --git a/lib/DBIx/Class/Storage/Debug/PrettyPrint.pm b/lib/DBIx/Class/Storage/Debug/PrettyPrint.pm index 8569dbc..94fcadc 100644 --- a/lib/DBIx/Class/Storage/Debug/PrettyPrint.pm +++ b/lib/DBIx/Class/Storage/Debug/PrettyPrint.pm @@ -8,8 +8,9 @@ use base 'DBIx::Class::Storage::Statistics'; use SQL::Abstract::Tree; __PACKAGE__->mk_group_accessors( simple => '_sqlat' ); -__PACKAGE__->mk_group_accessors( simple => 'clear_line_str' ); -__PACKAGE__->mk_group_accessors( simple => 'executing_str' ); +__PACKAGE__->mk_group_accessors( simple => '_clear_line_str' ); +__PACKAGE__->mk_group_accessors( simple => '_executing_str' ); +__PACKAGE__->mk_group_accessors( simple => '_show_progress' ); sub new { my $class = shift; @@ -20,12 +21,13 @@ sub new { my $c = \&Term::ANSIColor::color; $c->('blink white on_black') . 'EXECUTING...' . $c->('reset');; } : 'EXECUTING...'; -; + my $show_progress = defined $args->{show_progress} ? $args->{show_progress} : 1; my $sqlat = SQL::Abstract::Tree->new($args); my $self = $class->next::method(@_); - $self->clear_line_str($clear_line); - $self->executing_str($executing); + $self->_clear_line_str($clear_line); + $self->_executing_str($executing); + $self->_show_progress($show_progress); $self->_sqlat($sqlat); @@ -69,11 +71,11 @@ sub query_start { $self->print("$string\n", \@bind); - $self->debugfh->print($self->executing_str) + $self->debugfh->print($self->_executing_str) if $self->_show_progress } sub query_end { - $_[0]->debugfh->print($_[0]->clear_line_str); + $_[0]->debugfh->print($_[0]->_clear_line_str) if $_[0]->_show_progress } 1;