Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Perl-Critic CPAN distribution.

Report information
The Basics
Id: 30140
Status: resolved
Priority: 0/
Queue: Perl-Critic

People
Owner: Nobody in particular
Requestors:
Cc:
AdminCc:

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



Subject: -color option is ignored when piped to 'less -r'
I'd like to do this: perlcritic -color file.pl | less -R I *can* do this: ack --color pattern | less -R That is, less(1) can take raw input. I like it to take colored input. Having perlcritic make that decision for me keeps me from making it myself. See how Andy did the colorizing in ack(1). I like how it defaults based on is-a-tty, but lets me override it to get the behavior I want.
From: ELLIOTJS [...] cpan.org
Added to todo list.
From: ELLIOTJS [...] cpan.org
Added to todo list.
So does this mean it is always safe (and correct) to emit the colorized output even if STDOUT is not a tty? -Jeff
ack will default to color being on if the output is being sent to the screen and off otherwise. Any user specified option will override. That's the important thing, user options always override defaults. I've moved the logic to determine the color default inside OptionsProcessor because it needs to know if the user has overriden the default. I've also added a --pager option and PERLCRITIC_PAGER, similar to Ack, because what pager you use is a per-user config thing, not per project, and .perlcriticrc's are often per project. I put in a special case which is when pager is set to $PAGER it will use $ENV{PAGER}. That way you can set up the color and pager in a project config and still have it DTRT. Finally, the pager will not be used unless STDOUT is to a screen. This allows "perlcritic Something.pm > critic.out" continue to work in the presence of a default pager option. I don't know where to document those last two. I can't find a comprehensive document about the perlcritic options, the docs for options seem to be scattered around.

Message body is not shown because it is too large.

Subject: Re: [rt.cpan.org #30140] -color option is ignored when piped to 'less -r'
Date: Wed, 13 Aug 2008 23:09:53 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
Raw patch applied (with a small fix to deal with a change in perlcritic). Now running tests. Mass quantities of self compliance problems. :]
On Thu Aug 14 00:11:01 2008, clonezone wrote: Show quoted text
> Raw patch applied (with a small fix to deal with a change in > perlcritic). Now running tests. Mass quantities of self compliance > problems. :]
Self compliance problems?
Subject: Re: [rt.cpan.org #30140] -color option is ignored when piped to 'less -r'
Date: Fri, 15 Aug 2008 20:13:44 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
Michael G Schwern via RT wrote: Show quoted text
> On Thu Aug 14 00:11:01 2008, clonezone wrote:
>> Raw patch applied (with a small fix to deal with a change in >> perlcritic). Now running tests. Mass quantities of self compliance >> problems. :]
> > Self compliance problems?
Yeah, the self compliance tests. They're in xt/author/4?_criticize-*.t. Use M::B and run "./Build authortest".
Fixed and released in version 1.092.