Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #33 from djinn/feature/query_colors

Allow user to configure if queries will be shown in colours
  • Loading branch information...
commit abff58d7a1499b1a9120fbd992fd25de67e99e50 2 parents 239875f + cc8f6d6
Zaahir Moolla moollaza authored
Showing with 24 additions and 3 deletions.
  1. +11 −2 lib/App/DuckPAN/Query.pm
  2. +13 −1 lib/App/DuckPAN/Web.pm
13 lib/App/DuckPAN/Query.pm
View
@@ -5,8 +5,17 @@ use Moo;
my $query;
my $history_path;
-
-use Data::Printer;
+use Env qw( DP_NOCOLOR);
+# By setting the environment variable DP_NOCOLOR or ANSI_COLORS_DISABLED
+# change the behaviour of query printer on console.
+if ($DP_NOCOLOR) {
+ require Data::Printer;
+ import Data::Printer colored => 0;
+}
+else {
+ require Data::Printer;
+ import Data::Printer;
+}
use POE qw( Wheel::ReadLine );
sub run {
14 lib/App/DuckPAN/Web.pm
View
@@ -10,7 +10,6 @@ use Plack::Response;
use HTML::Entities;
use HTML::TreeBuilder;
use HTML::Element;
-use Data::Printer;
use IO::All -utf8;
use HTTP::Request;
use LWP::UserAgent;
@@ -18,6 +17,19 @@ use URI::Escape;
use JSON;
use Data::Dumper;
+use Env qw( DP_NOCOLOR);
+# By setting the environment variable DP_NOCOLOR or ANSI_COLORS_DISABLED
+# change the behaviour of query printer on console.
+if ($DP_NOCOLOR) {
+ require Data::Printer;
+ import Data::Printer colored => 0;
+}
+else {
+ require Data::Printer;
+ import Data::Printer;
+}
+
+
has blocks => ( is => 'ro', required => 1 );
has page_root => ( is => 'ro', required => 1 );
has page_spice => ( is => 'ro', required => 1 );
Please sign in to comment.
Something went wrong with that request. Please try again.