Skip Menu |

This queue is for tickets about the Regexp-Debugger CPAN distribution.

Report information
The Basics
Id: 78468
Status: resolved
Priority: 0/
Queue: Regexp-Debugger

People
Owner: Nobody in particular
Requestors: MITHALDU [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: colors don't work on windows and there's no repo link so i can't patch easily
The colors don't work on windows right now, but are relatively easy to fix by applying depending on platform. I'd happily write a patch, but i'd rather base if off the actual repo. Can you please link to it?
On Thu Jul 19 15:17:03 2012, MITHALDU wrote: Show quoted text
> The colors don't work on windows right now, but are relatively easy to > fix by applying depending on platform. I'd happily write a patch, but i'd > rather base if off the actual repo. Can you please link to it?
Sorry, there's no public repo. Happy to accept patches against any version of the distrubution. Thanks, Damian
Alright, attached are two patches. One contains a fix for a thing i noticed while debugging, the other fixes the colors. :)
Subject: 0002-implement-color-fallback-for-Win32.patch
From ecc5677de274efd2ddc45cc539da47efec39e70b Mon Sep 17 00:00:00 2001 From: Christian Walde <walde.christian@googlemail.com> Date: Sun, 22 Jul 2012 15:01:10 +0200 Subject: [PATCH 2/2] implement color fallback for Win32 - Win32::Console::ANSI is an XS module that rewrites STDOUT handling to filter for color codes. Simply loading it is sufficient. - Term::ANSIColor is only loaded on non-win32 systems or those equipped with W::C::A to avoid redefinition warnings when registering the pass-through function. --- lib/Regexp/Debugger.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Regexp/Debugger.pm b/lib/Regexp/Debugger.pm index 8e6ecd8..ba64aca 100644 --- a/lib/Regexp/Debugger.pm +++ b/lib/Regexp/Debugger.pm @@ -89,7 +89,9 @@ my $heatmaps_invisible; # Simulate Term::ANSIColor (badly, if necessary)... CHECK { - if (!eval{ require Term::ANSIColor }) { + my $can_color = ( $^O ne 'MSWin32' or eval { require Win32::Console::ANSI } ); + $can_color = eval { require Term::ANSIColor } if $can_color; + if ( !$can_color ) { *Term::ANSIColor::colored = sub { return shift }; $MATCH_DRAG = '_'; $heatmaps_invisible = 1; -- 1.7.10.msysgit.1
Subject: 0001-ENV-HOME-is-not-reliable-so-let-s-use-File-HomeDir-i.patch
From 448c0cb659538eff900bc697256e6c82081a2522 Mon Sep 17 00:00:00 2001 From: Christian Walde <walde.christian@googlemail.com> Date: Sun, 22 Jul 2012 14:38:06 +0200 Subject: [PATCH 1/2] $ENV{HOME} is not reliable, so let's use File::HomeDir if available, or just skip that part --- lib/Regexp/Debugger.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Regexp/Debugger.pm b/lib/Regexp/Debugger.pm index 7ced7cb..8e6ecd8 100644 --- a/lib/Regexp/Debugger.pm +++ b/lib/Regexp/Debugger.pm @@ -157,9 +157,12 @@ sub _load_config { my $explicit_config_ref = shift(); my %config; + my $home_dir = $ENV{HOME}; + $home_dir ||= File::HomeDir->my_home if eval { require File::HomeDir }; + # Find config file... CONFIG_FILE: - for my $config_file ('.rxrx', "$ENV{HOME}/.rxrx") { + for my $config_file ( '.rxrx', ( $home_dir ? "$home_dir/.rxrx" : () ) ) { # Is this a readable config file??? open my $fh, '<', $config_file -- 1.7.10.msysgit.1
Subject: Re: [rt.cpan.org #78468] colors don't work on windows and there's no repo link so i can't patch easily
Date: Mon, 23 Jul 2012 10:13:51 +1000
To: bug-Regexp-Debugger [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Thanks, Christian. Both patches gratefully applied. Damian