Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make Win32::Console::ANSI optional
  • Loading branch information
hinrik committed Jul 24, 2009
1 parent 28dd10d commit 783b3f0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changes
@@ -1,5 +1,6 @@
0.14
- Remove Module::Install::AuthorRequires for now, it's not working right
- Make Win32::Console::ANSI optional

0.13 Thu Jul 16 06:14:13 GMT 2009
- Look up things from the Perl 6 Table Index
Expand Down
1 change: 0 additions & 1 deletion Makefile.PL
Expand Up @@ -22,7 +22,6 @@ requires ('Perl6::Perldoc' => '0.0.5');
requires ('Perl6::Perldoc::To::Ansi' => '0.07');
requires ('Pod::Text::Ansi' => '0.03');
requires ('Pod::Xhtml' => '0');
requires ('Win32::Console::ANSI' => '0') if $^O eq 'MSWin32';
test_requires ('Test::More' => '0');
test_requires ('Test::Script' => '0');
#author_requires('Perl::Critic' => '1.098');
Expand Down
15 changes: 14 additions & 1 deletion lib/App/Grok.pm
Expand Up @@ -14,6 +14,19 @@ use Pod::Usage;
our $VERSION = '0.13';
my %opt;

our $GOT_ANSI;
BEGIN {
if ($^O ne 'Win32') {
eval {
require Win32::Console::ANSI;
$GOT_ANSI = 1;
}
}
else {
$GOT_ANSI = 1;
}
}

sub new {
my ($package, %self) = @_;
return bless \%self, $package;
Expand Down Expand Up @@ -61,7 +74,7 @@ sub _get_options {
'h|help' => sub { pod2usage(1) },
'i|index' => \$opt{index},
'l|only' => \$opt{only},
'o|output=s' => \($opt{output} = 'ansi'),
'o|output=s' => \($opt{output} = $GOT_ANSI ? 'ansi' : 'text'),
'T|no-pager' => \$opt{no_pager},
'u|unformatted' => sub { $opt{output} = 'pod' },
'V|version' => sub { print "grok $VERSION\n"; exit },
Expand Down

0 comments on commit 783b3f0

Please sign in to comment.