The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
.gitignore 017
ANSIColor.pm 7480
Build.PL 042
ChangeLog 3720
LICENSE 047
MANIFEST 1331
MANIFEST.SKIP 041
META.json 047
META.yml 1822
Makefile.PL 1615
NEWS 0247
README 57132
examples/generate-colors 0298
lib/Term/ANSIColor.pm 01222
t/basic.t 1510
t/data/perl.conf 018
t/data/perlcriticrc 0100
t/data/perltidyrc 014
t/docs/pod-coverage.t 047
t/docs/pod-spelling.t 066
t/docs/pod.t 065
t/docs/synopsis.t 060
t/eval.t 250
t/lib/Test/RRA/Config.pm 0218
t/lib/Test/RRA.pm 0260
t/module/aliases-env.t 081
t/module/aliases-func.t 088
t/module/basic.t 0369
t/module/basic256.t 0129
t/module/eval.t 060
t/module/stringify.t 054
t/pod-spelling.t 750
t/pod.t 110
t/stringify.t 380
t/style/coverage.t 071
t/style/critic.t 087
t/style/minimum-version.t 047
t/style/strict.t 056
t/taint/basic.t 039
tests/README 80
tests/ansicolor 170
tests/vt100-torture 600
42 files changed (This is a version diff) 16094090
@@ -0,0 +1,17 @@
+/Build
+/Build.bat
+/MANIFEST.bak
+/Makefile
+/Makefile.PL
+/Makefile.old
+/META.yml
+/META.json
+/MYMETA.json
+/MYMETA.yml
+/Term-ANSIColor-*/
+/Term-ANSIColor-*.tar.gz
+/Term-ANSIColor-*.tar.gz.asc
+/_build/
+/blib/
+/cover_db/
+/pm_to_blib
@@ -1,748 +0,0 @@
-# Term::ANSIColor -- Color screen output using ANSI escape sequences.
-#
-# Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2005, 2006, 2008, 2009, 2010,
-#     2011, 2012 Russ Allbery <rra@stanford.edu> and Zenin
-# PUSH/POP support submitted 2007 by openmethods.com voice solutions
-#
-# This program is free software; you may redistribute it and/or modify it
-# under the same terms as Perl itself.
-#
-# Ah, September, when the sysadmins turn colors and fall off the trees....
-#                               -- Dave Van Domelen
-
-##############################################################################
-# Modules and declarations
-##############################################################################
-
-package Term::ANSIColor;
-require 5.001;
-
-$VERSION = '3.02';
-
-use strict;
-use vars qw($AUTOLOAD $AUTOLOCAL $AUTORESET @COLORLIST @COLORSTACK $EACHLINE
-            @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION %ATTRIBUTES
-            %ATTRIBUTES_R);
-
-use Exporter ();
-BEGIN {
-    @COLORLIST = qw(
-        CLEAR           RESET             BOLD            DARK
-        FAINT           ITALIC            UNDERLINE       UNDERSCORE
-        BLINK           REVERSE           CONCEALED
-
-        BLACK           RED               GREEN           YELLOW
-        BLUE            MAGENTA           CYAN            WHITE
-        ON_BLACK        ON_RED            ON_GREEN        ON_YELLOW
-        ON_BLUE         ON_MAGENTA        ON_CYAN         ON_WHITE
-
-        BRIGHT_BLACK    BRIGHT_RED        BRIGHT_GREEN    BRIGHT_YELLOW
-        BRIGHT_BLUE     BRIGHT_MAGENTA    BRIGHT_CYAN     BRIGHT_WHITE
-        ON_BRIGHT_BLACK ON_BRIGHT_RED     ON_BRIGHT_GREEN ON_BRIGHT_YELLOW
-        ON_BRIGHT_BLUE  ON_BRIGHT_MAGENTA ON_BRIGHT_CYAN  ON_BRIGHT_WHITE
-    );
-    @ISA         = qw(Exporter);
-    @EXPORT      = qw(color colored);
-    @EXPORT_OK   = qw(uncolor colorstrip colorvalid);
-    %EXPORT_TAGS = (constants => \@COLORLIST,
-                    pushpop   => [ @COLORLIST,
-                                   qw(PUSHCOLOR POPCOLOR LOCALCOLOR) ]);
-    Exporter::export_ok_tags ('pushpop');
-}
-
-##############################################################################
-# Internal data structures
-##############################################################################
-
-%ATTRIBUTES = ('clear'          => 0,
-               'reset'          => 0,
-               'bold'           => 1,
-               'dark'           => 2,
-               'faint'          => 2,
-               'italic'         => 3,
-               'underline'      => 4,
-               'underscore'     => 4,
-               'blink'          => 5,
-               'reverse'        => 7,
-               'concealed'      => 8,
-
-               'black'          => 30,   'on_black'          => 40,
-               'red'            => 31,   'on_red'            => 41,
-               'green'          => 32,   'on_green'          => 42,
-               'yellow'         => 33,   'on_yellow'         => 43,
-               'blue'           => 34,   'on_blue'           => 44,
-               'magenta'        => 35,   'on_magenta'        => 45,
-               'cyan'           => 36,   'on_cyan'           => 46,
-               'white'          => 37,   'on_white'          => 47,
-
-               'bright_black'   => 90,   'on_bright_black'   => 100,
-               'bright_red'     => 91,   'on_bright_red'     => 101,
-               'bright_green'   => 92,   'on_bright_green'   => 102,
-               'bright_yellow'  => 93,   'on_bright_yellow'  => 103,
-               'bright_blue'    => 94,   'on_bright_blue'    => 104,
-               'bright_magenta' => 95,   'on_bright_magenta' => 105,
-               'bright_cyan'    => 96,   'on_bright_cyan'    => 106,
-               'bright_white'   => 97,   'on_bright_white'   => 107,
-               );
-
-# Reverse lookup.  Alphabetically first name for a sequence is preferred.
-for (reverse sort keys %ATTRIBUTES) {
-    $ATTRIBUTES_R{$ATTRIBUTES{$_}} = $_;
-}
-
-##############################################################################
-# Implementation (constant form)
-##############################################################################
-
-# Time to have fun!  We now want to define the constant subs, which are named
-# the same as the attributes above but in all caps.  Each constant sub needs
-# to act differently depending on whether $AUTORESET is set.  Without
-# autoreset:
-#
-#     BLUE "text\n"  ==>  "\e[34mtext\n"
-#
-# If $AUTORESET is set, we should instead get:
-#
-#     BLUE "text\n"  ==>  "\e[34mtext\n\e[0m"
-#
-# The sub also needs to handle the case where it has no arguments correctly.
-# Maintaining all of this as separate subs would be a major nightmare, as well
-# as duplicate the %ATTRIBUTES hash, so instead we define an AUTOLOAD sub to
-# define the constant subs on demand.  To do that, we check the name of the
-# called sub against the list of attributes, and if it's an all-caps version
-# of one of them, we define the sub on the fly and then run it.
-#
-# If the environment variable ANSI_COLORS_DISABLED is set, just return the
-# arguments without adding any escape sequences.  This is to make it easier to
-# write scripts that also work on systems without any ANSI support, like
-# Windows consoles.
-sub AUTOLOAD {
-    if ($AUTOLOAD =~ /^([\w:]*::([A-Z_]+))$/ and defined $ATTRIBUTES{lc $2}) {
-        if (defined $ENV{ANSI_COLORS_DISABLED}) {
-            return join ('', @_);
-        }
-        $AUTOLOAD = $1;
-        my $attr = "\e[" . $ATTRIBUTES{lc $2} . 'm';
-        my $saved = $@;
-        eval qq {
-            sub $AUTOLOAD {
-                if (\$AUTORESET && \@_) {
-                    return '$attr' . join ('', \@_) . "\e[0m";
-                } elsif (\$AUTOLOCAL && \@_) {
-                    return PUSHCOLOR ('$attr') . join ('', \@_) . POPCOLOR;
-                } else {
-                    return '$attr' . join ('', \@_);
-                }
-            }
-        };
-        die "failed to generate constant $1" if $@;
-        $@ = $saved;
-        goto &$AUTOLOAD;
-    } else {
-        require Carp;
-        Carp::croak ("undefined subroutine &$AUTOLOAD called");
-    }
-}
-
-# Append a new color to the top of the color stack and return the top of
-# the stack.
-sub PUSHCOLOR {
-    my ($text) = @_;
-    my ($color) = ($text =~ m/^((?:\e\[[\d;]+m)+)/);
-    if (@COLORSTACK) {
-        $color = $COLORSTACK[-1] . $color;
-    }
-    push (@COLORSTACK, $color);
-    return $text;
-}
-
-# Pop the color stack and return the new top of the stack (or reset, if
-# the stack is empty).
-sub POPCOLOR {
-    pop @COLORSTACK;
-    if (@COLORSTACK) {
-        return $COLORSTACK[-1] . join ('', @_);
-    } else {
-        return RESET (@_);
-    }
-}
-
-# Surround arguments with a push and a pop.
-sub LOCALCOLOR {
-    return PUSHCOLOR (join ('', @_)) . POPCOLOR ();
-}
-
-##############################################################################
-# Implementation (attribute string form)
-##############################################################################
-
-# Return the escape code for a given set of color attributes.
-sub color {
-    return '' if defined $ENV{ANSI_COLORS_DISABLED};
-    my @codes = map { split } @_;
-    my $attribute = '';
-    foreach (@codes) {
-        $_ = lc $_;
-        unless (defined $ATTRIBUTES{$_}) {
-            require Carp;
-            Carp::croak ("Invalid attribute name $_");
-        }
-        $attribute .= $ATTRIBUTES{$_} . ';';
-    }
-    chop $attribute;
-    return ($attribute ne '') ? "\e[${attribute}m" : undef;
-}
-
-# Return a list of named color attributes for a given set of escape codes.
-# Escape sequences can be given with or without enclosing "\e[" and "m".  The
-# empty escape sequence '' or "\e[m" gives an empty list of attrs.
-sub uncolor {
-    my (@nums, @result);
-    for (@_) {
-        my $escape = $_;
-        $escape =~ s/^\e\[//;
-        $escape =~ s/m$//;
-        unless ($escape =~ /^((?:\d+;)*\d*)$/) {
-            require Carp;
-            Carp::croak ("Bad escape sequence $escape");
-        }
-        push (@nums, split (/;/, $1));
-    }
-    for (@nums) {
-        $_ += 0; # Strip leading zeroes
-        my $name = $ATTRIBUTES_R{$_};
-        if (!defined $name) {
-            require Carp;
-            Carp::croak ("No name for escape sequence $_" );
-        }
-        push (@result, $name);
-    }
-    return @result;
-}
-
-# Given a string and a set of attributes, returns the string surrounded by
-# escape codes to set those attributes and then clear them at the end of the
-# string.  The attributes can be given either as an array ref as the first
-# argument or as a list as the second and subsequent arguments.  If $EACHLINE
-# is set, insert a reset before each occurrence of the string $EACHLINE and
-# the starting attribute code after the string $EACHLINE, so that no attribute
-# crosses line delimiters (this is often desirable if the output is to be
-# piped to a pager or some other program).
-sub colored {
-    my ($string, @codes);
-    if (ref ($_[0]) && ref ($_[0]) eq 'ARRAY') {
-        @codes = @{+shift};
-        $string = join ('', @_);
-    } else {
-        $string = shift;
-        @codes = @_;
-    }
-    return $string if defined $ENV{ANSI_COLORS_DISABLED};
-    if (defined $EACHLINE) {
-        my $attr = color (@codes);
-        return join '',
-            map { ($_ ne $EACHLINE) ? $attr . $_ . "\e[0m" : $_ }
-                grep { length ($_) > 0 }
-                    split (/(\Q$EACHLINE\E)/, $string);
-    } else {
-        return color (@codes) . $string . "\e[0m";
-    }
-}
-
-# Given a string, strip the ANSI color codes out of that string and return the
-# result.  This removes only ANSI color codes, not movement codes and other
-# escape sequences.
-sub colorstrip {
-    my (@string) = @_;
-    for my $string (@string) {
-        $string =~ s/\e\[[\d;]*m//g;
-    }
-    return wantarray ? @string : join ('', @string);
-}
-
-# Given a list of color attributes (arguments for color, for instance), return
-# true if they're all valid or false if any of them are invalid.
-sub colorvalid {
-    my @codes = map { split } @_;
-    for (@codes) {
-        unless (defined $ATTRIBUTES{lc $_}) {
-            return;
-        }
-    }
-    return 1;
-}
-
-##############################################################################
-# Module return value and documentation
-##############################################################################
-
-# Ensure we evaluate to true.
-1;
-__END__
-
-=head1 NAME
-
-Term::ANSIColor - Color screen output using ANSI escape sequences
-
-=for stopwords
-cyan colorize namespace runtime TMTOWTDI cmd.exe 4nt.exe command.com NT
-ESC Delvare SSH OpenSSH aixterm ECMA-048 Fraktur overlining Zenin
-reimplemented Allbery PUSHCOLOR POPCOLOR LOCALCOLOR openmethods.com
-grey ATTR urxvt mistyped
-
-=head1 SYNOPSIS
-
-    use Term::ANSIColor;
-    print color 'bold blue';
-    print "This text is bold blue.\n";
-    print color 'reset';
-    print "This text is normal.\n";
-    print colored ("Yellow on magenta.", 'yellow on_magenta'), "\n";
-    print "This text is normal.\n";
-    print colored ['yellow on_magenta'], 'Yellow on magenta.', "\n";
-    print colored ['red on_bright_yellow'], 'Red on bright yellow.', "\n";
-    print colored ['bright_red on_black'], 'Bright red on black.', "\n";
-    print "\n";
-
-    use Term::ANSIColor qw(uncolor);
-    print uncolor ('01;31'), "\n";
-
-    use Term::ANSIColor qw(colorstrip);
-    print colorstrip '\e[1mThis is bold\e[0m', "\n";
-
-    use Term::ANSIColor qw(colorvalid);
-    my $valid = colorvalid ('blue bold', 'on_magenta');
-    print "Color string is ", $valid ? "valid\n" : "invalid\n";
-
-    use Term::ANSIColor qw(:constants);
-    print BOLD, BLUE, "This text is in bold blue.\n", RESET;
-
-    use Term::ANSIColor qw(:constants);
-    {
-        local $Term::ANSIColor::AUTORESET = 1;
-        print BOLD BLUE "This text is in bold blue.\n";
-        print "This text is normal.\n";
-    }
-
-    use Term::ANSIColor qw(:pushpop);
-    print PUSHCOLOR RED ON_GREEN "This text is red on green.\n";
-    print PUSHCOLOR BRIGHT_BLUE "This text is bright blue on green.\n";
-    print RESET BRIGHT_BLUE "This text is just bright blue.\n";
-    print POPCOLOR "Back to red on green.\n";
-    print LOCALCOLOR GREEN ON_BLUE "This text is green on blue.\n";
-    print "This text is red on green.\n";
-    {
-        local $Term::ANSIColor::AUTOLOCAL = 1;
-        print ON_BLUE "This text is red on blue.\n";
-        print "This text is red on green.\n";
-    }
-    print POPCOLOR "Back to whatever we started as.\n";
-
-=head1 DESCRIPTION
-
-This module has two interfaces, one through color() and colored() and the
-other through constants.  It also offers the utility functions uncolor(),
-colorstrip(), and colorvalid(), which have to be explicitly imported to be
-used (see L</SYNOPSIS>).
-
-=head2 Supported Colors
-
-Terminal emulators that support color divide into two types: ones that
-support only eight colors, and ones that support sixteen.  This module
-provides both the ANSI escape codes for the "normal" colors, supported by
-both types, as well as the additional colors supported by sixteen-color
-emulators.  These colors are referred to as ANSI colors 0 through 7
-(normal) and 8 through 15.
-
-Unfortunately, interpretation of colors 0 through 7 often depends on
-whether the emulator supports eight colors or sixteen colors.  Emulators
-that only support eight colors (such as the Linux console) will display
-colors 0 through 7 with normal brightness and ignore colors 8 through 15,
-treating them the same as white.  Emulators that support 16 colors, such
-as gnome-terminal, normally display colors 0 through 7 as dim or darker
-versions and colors 8 through 15 as normal brightness.  On such emulators,
-the "normal" white (color 7) usually is shown as pale grey, requiring
-bright white (15) to be used to get a real white color.  Bright black
-usually is a dark grey color, although some terminals display it as pure
-black.  Some sixteen-color terminal emulators also treat normal yellow
-(color 3) as orange or brown, and bright yellow (color 11) as yellow.
-
-Following the normal convention of sixteen-color emulators, this module
-provides a pair of attributes for each color.  For every normal color (0
-through 7), the corresponding bright color (8 through 15) is obtained by
-prepending the string C<bright_> to the normal color name.  For example,
-C<red> is color 1 and C<bright_red> is color 9.  The same applies for
-background colors: C<on_red> is the normal color and C<on_bright_red> is
-the bright color.  Capitalize these strings for the constant interface.
-
-There is unfortunately no way to know whether the current emulator
-supports sixteen colors or not, which makes the choice of colors
-difficult.  The most conservative choice is to use only the regular
-colors, which are at least displayed on all emulators.  However, they will
-appear dark in sixteen-color terminal emulators, including most common
-emulators in UNIX X environments.  If you know the display is one of those
-emulators, you may wish to use the bright variants instead.  Even better,
-offer the user a way to configure the colors for a given application to
-fit their terminal emulator.
-
-Support for colors 8 through 15 (the C<bright_> variants) was added in
-Term::ANSIColor 3.0.
-
-=head2 Function Interface
-
-The function interface uses attribute strings to describe the colors and
-text attributes to assign to text.  The recognized non-color attributes
-are clear, reset, bold, dark, faint, italic, underline, underscore, blink,
-reverse, and concealed.  Clear and reset (reset to default attributes),
-dark and faint (dim and saturated), and underline and underscore are
-equivalent, so use whichever is the most intuitive to you.
-
-Note that not all attributes are supported by all terminal types, and some
-terminals may not support any of these sequences.  Dark and faint, italic,
-blink, and concealed in particular are frequently not implemented.
-
-Support for italic was added in Term::ANSIColor 3.02.
-
-The recognized normal foreground color attributes (colors 0 to 7) are:
-
-  black  red  green  yellow  blue  magenta  cyan  white
-
-The corresponding bright foreground color attributes (colors 8 to 15) are:
-
-  bright_black  bright_red      bright_green  bright_yellow
-  bright_blue   bright_magenta  bright_cyan   bright_white
-
-The recognized normal background color attributes (colors 0 to 7) are:
-
-  on_black  on_red      on_green  on yellow
-  on_blue   on_magenta  on_cyan   on_white
-
-The recognized bright background color attributes (colors 8 to 15) are:
-
-  on_bright_black  on_bright_red      on_bright_green  on_bright_yellow
-  on_bright_blue   on_bright_magenta  on_bright_cyan   on_bright_white
-
-For any of the above listed attributes, case is not significant.
-
-Attributes, once set, last until they are unset (by printing the attribute
-C<clear> or C<reset>).  Be careful to do this, or otherwise your attribute
-will last after your script is done running, and people get very annoyed
-at having their prompt and typing changed to weird colors.
-
-=over 4
-
-=item color(ATTR[, ATTR ...])
-
-color() takes any number of strings as arguments and considers them to be
-space-separated lists of attributes.  It then forms and returns the escape
-sequence to set those attributes.  It doesn't print it out, just returns
-it, so you'll have to print it yourself if you want to.  This is so that
-you can save it as a string, pass it to something else, send it to a file
-handle, or do anything else with it that you might care to.  color()
-throws an exception if given an invalid attribute.
-
-=item colored(STRING, ATTRIBUTES)
-
-=item colored(ATTR-REF, STRING[, STRING...])
-
-As an aid in resetting colors, colored() takes a scalar as the first
-argument and any number of attribute strings as the second argument and
-returns the scalar wrapped in escape codes so that the attributes will be
-set as requested before the string and reset to normal after the string.
-Alternately, you can pass a reference to an array as the first argument,
-and then the contents of that array will be taken as attributes and color
-codes and the remainder of the arguments as text to colorize.
-
-Normally, colored() just puts attribute codes at the beginning and end of
-the string, but if you set $Term::ANSIColor::EACHLINE to some string, that
-string will be considered the line delimiter and the attribute will be set
-at the beginning of each line of the passed string and reset at the end of
-each line.  This is often desirable if the output contains newlines and
-you're using background colors, since a background color that persists
-across a newline is often interpreted by the terminal as providing the
-default background color for the next line.  Programs like pagers can also
-be confused by attributes that span lines.  Normally you'll want to set
-$Term::ANSIColor::EACHLINE to C<"\n"> to use this feature.
-
-=item uncolor(ESCAPE)
-
-uncolor() performs the opposite translation as color(), turning escape
-sequences into a list of strings corresponding to the attributes being set
-by those sequences.
-
-=item colorstrip(STRING[, STRING ...])
-
-colorstrip() removes all color escape sequences from the provided strings,
-returning the modified strings separately in array context or joined
-together in scalar context.  Its arguments are not modified.
-
-=item colorvalid(ATTR[, ATTR ...])
-
-colorvalid() takes attribute strings the same as color() and returns true
-if all attributes are known and false otherwise.
-
-=back
-
-=head2 Constant Interface
-
-Alternately, if you import C<:constants>, you can use the following
-constants directly:
-
-  CLEAR           RESET             BOLD            DARK
-  FAINT           ITALIC            UNDERLINE       UNDERSCORE
-  BLINK           REVERSE           CONCEALED
-
-  BLACK           RED               GREEN           YELLOW
-  BLUE            MAGENTA           CYAN            WHITE
-  BRIGHT_BLACK    BRIGHT_RED        BRIGHT_GREEN    BRIGHT_YELLOW
-  BRIGHT_BLUE     BRIGHT_MAGENTA    BRIGHT_CYAN     BRIGHT_WHITE
-
-  ON_BLACK        ON_RED            ON_GREEN        ON_YELLOW
-  ON_BLUE         ON_MAGENTA        ON_CYAN         ON_WHITE
-  ON_BRIGHT_BLACK ON_BRIGHT_RED     ON_BRIGHT_GREEN ON_BRIGHT_YELLOW
-  ON_BRIGHT_BLUE  ON_BRIGHT_MAGENTA ON_BRIGHT_CYAN  ON_BRIGHT_WHITE
-
-These are the same as color('attribute') and can be used if you prefer
-typing:
-
-    print BOLD BLUE ON_WHITE "Text", RESET, "\n";
-
-to
-
-    print colored ("Text", 'bold blue on_white'), "\n";
-
-(Note that the newline is kept separate to avoid confusing the terminal as
-described above since a background color is being used.)
-
-Support for C<ITALIC> was added in Term::ANSIColor 3.02.
-
-When using the constants, if you don't want to have to remember to add the
-C<, RESET> at the end of each print line, you can set
-$Term::ANSIColor::AUTORESET to a true value.  Then, the display mode will
-automatically be reset if there is no comma after the constant.  In other
-words, with that variable set:
-
-    print BOLD BLUE "Text\n";
-
-will reset the display mode afterward, whereas:
-
-    print BOLD, BLUE, "Text\n";
-
-will not.  If you are using background colors, you will probably want to
-print the newline with a separate print statement to avoid confusing the
-terminal.
-
-The subroutine interface has the advantage over the constants interface in
-that only two subroutines are exported into your namespace, versus
-thirty-eight in the constants interface.  On the flip side, the constants
-interface has the advantage of better compile time error checking, since
-misspelled names of colors or attributes in calls to color() and colored()
-won't be caught until runtime whereas misspelled names of constants will
-be caught at compile time.  So, pollute your namespace with almost two
-dozen subroutines that you may not even use that often, or risk a silly
-bug by mistyping an attribute.  Your choice, TMTOWTDI after all.
-
-=head2 The Color Stack
-
-As of Term::ANSIColor 2.0, you can import C<:pushpop> and maintain a stack
-of colors using PUSHCOLOR, POPCOLOR, and LOCALCOLOR.  PUSHCOLOR takes the
-attribute string that starts its argument and pushes it onto a stack of
-attributes.  POPCOLOR removes the top of the stack and restores the
-previous attributes set by the argument of a prior PUSHCOLOR.  LOCALCOLOR
-surrounds its argument in a PUSHCOLOR and POPCOLOR so that the color
-resets afterward.
-
-When using PUSHCOLOR, POPCOLOR, and LOCALCOLOR, it's particularly
-important to not put commas between the constants.
-
-    print PUSHCOLOR BLUE "Text\n";
-
-will correctly push BLUE onto the top of the stack.
-
-    print PUSHCOLOR, BLUE, "Text\n";    # wrong!
-
-will not, and a subsequent pop won't restore the correct attributes.
-PUSHCOLOR pushes the attributes set by its argument, which is normally a
-string of color constants.  It can't ask the terminal what the current
-attributes are.
-
-=head1 DIAGNOSTICS
-
-=over 4
-
-=item Bad escape sequence %s
-
-(F) You passed an invalid ANSI escape sequence to uncolor().
-
-=item Bareword "%s" not allowed while "strict subs" in use
-
-(F) You probably mistyped a constant color name such as:
-
-    $Foobar = FOOBAR . "This line should be blue\n";
-
-or:
-
-    @Foobar = FOOBAR, "This line should be blue\n";
-
-This will only show up under use strict (another good reason to run under
-use strict).
-
-=item Invalid attribute name %s
-
-(F) You passed an invalid attribute name to either color() or colored().
-
-=item Name "%s" used only once: possible typo
-
-(W) You probably mistyped a constant color name such as:
-
-    print FOOBAR "This text is color FOOBAR\n";
-
-It's probably better to always use commas after constant names in order to
-force the next error.
-
-=item No comma allowed after filehandle
-
-(F) You probably mistyped a constant color name such as:
-
-    print FOOBAR, "This text is color FOOBAR\n";
-
-Generating this fatal compile error is one of the main advantages of using
-the constants interface, since you'll immediately know if you mistype a
-color name.
-
-=item No name for escape sequence %s
-
-(F) The ANSI escape sequence passed to uncolor() contains escapes which
-aren't recognized and can't be translated to names.
-
-=back
-
-=head1 ENVIRONMENT
-
-=over 4
-
-=item ANSI_COLORS_DISABLED
-
-If this environment variable is set, all of the functions defined by this
-module (color(), colored(), and all of the constants not previously used
-in the program) will not output any escape sequences and instead will just
-return the empty string or pass through the original text as appropriate.
-This is intended to support easy use of scripts using this module on
-platforms that don't support ANSI escape sequences.
-
-For it to have its proper effect, this environment variable must be set
-before any color constants are used in the program.
-
-=back
-
-=head1 RESTRICTIONS
-
-It would be nice if one could leave off the commas around the constants
-entirely and just say:
-
-    print BOLD BLUE ON_WHITE "Text\n" RESET;
-
-but the syntax of Perl doesn't allow this.  You need a comma after the
-string.  (Of course, you may consider it a bug that commas between all the
-constants aren't required, in which case you may feel free to insert
-commas unless you're using $Term::ANSIColor::AUTORESET or
-PUSHCOLOR/POPCOLOR.)
-
-For easier debugging, you may prefer to always use the commas when not
-setting $Term::ANSIColor::AUTORESET or PUSHCOLOR/POPCOLOR so that you'll
-get a fatal compile error rather than a warning.
-
-It's not possible to use this module to embed formatting and color
-attributes using Perl formats.  They replace the escape character with a
-space (as documented in L<perlform(1)>), resulting in garbled output from
-the unrecognized attribute.  Even if there were a way around that problem,
-the format doesn't know that the non-printing escape sequence is
-zero-length and would incorrectly format the output.  For formatted output
-using color or other attributes, either use sprintf() instead or use
-formline() and then add the color or other attributes after formatting and
-before output.
-
-=head1 NOTES
-
-The codes generated by this module are standard terminal control codes,
-complying with ECMA-048 and ISO 6429 (generally referred to as "ANSI
-color" for the color codes).  The non-color control codes (bold, dark,
-italic, underline, and reverse) are part of the earlier ANSI X3.64
-standard for control sequences for video terminals and peripherals.
-
-Note that not all displays are ISO 6429-compliant, or even X3.64-compliant
-(or are even attempting to be so).  This module will not work as expected
-on displays that do not honor these escape sequences, such as cmd.exe,
-4nt.exe, and command.com under either Windows NT or Windows 2000.  They
-may just be ignored, or they may display as an ESC character followed by
-some apparent garbage.
-
-Jean Delvare provided the following table of different common terminal
-emulators and their support for the various attributes and others have
-helped me flesh it out:
-
-              clear    bold     faint   under    blink   reverse  conceal
- ------------------------------------------------------------------------
- xterm         yes      yes      no      yes      yes      yes      yes
- linux         yes      yes      yes    bold      yes      yes      no
- rxvt          yes      yes      no      yes  bold/black   yes      no
- dtterm        yes      yes      yes     yes    reverse    yes      yes
- teraterm      yes    reverse    no      yes    rev/red    yes      no
- aixterm      kinda   normal     no      yes      no       yes      yes
- PuTTY         yes     color     no      yes      no       yes      no
- Windows       yes      no       no      no       no       yes      no
- Cygwin SSH    yes      yes      no     color    color    color     yes
- Mac Terminal  yes      yes      no      yes      yes      yes      yes
-
-Windows is Windows telnet, Cygwin SSH is the OpenSSH implementation under
-Cygwin on Windows NT, and Mac Terminal is the Terminal application in Mac
-OS X.  Where the entry is other than yes or no, that emulator displays the
-given attribute as something else instead.  Note that on an aixterm, clear
-doesn't reset colors; you have to explicitly set the colors back to what
-you want.  More entries in this table are welcome.
-
-Support for code 3 (italic) is rare and therefore not mentioned in that
-table.  It is not believed to be fully supported by any of the terminals
-listed, although it's displayed as green in the Linux console, but it is
-reportedly supported by urxvt.
-
-Note that codes 6 (rapid blink) and 9 (strike-through) are specified in
-ANSI X3.64 and ECMA-048 but are not commonly supported by most displays
-and emulators and therefore aren't supported by this module at the present
-time.  ECMA-048 also specifies a large number of other attributes,
-including a sequence of attributes for font changes, Fraktur characters,
-double-underlining, framing, circling, and overlining.  As none of these
-attributes are widely supported or useful, they also aren't currently
-supported by this module.
-
-=head1 SEE ALSO
-
-ECMA-048 is available on-line (at least at the time of this writing) at
-L<http://www.ecma-international.org/publications/standards/Ecma-048.htm>.
-
-ISO 6429 is available from ISO for a charge; the author of this module
-does not own a copy of it.  Since the source material for ISO 6429 was
-ECMA-048 and the latter is available for free, there seems little reason
-to obtain the ISO standard.
-
-The current version of this module is always available from its web site
-at L<http://www.eyrie.org/~eagle/software/ansicolor/>.  It is also part of
-the Perl core distribution as of 5.6.0.
-
-=head1 AUTHORS
-
-Original idea (using constants) by Zenin, reimplemented using subs by Russ
-Allbery <rra@stanford.edu>, and then combined with the original idea by
-Russ with input from Zenin.  Russ Allbery now maintains this module.
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2005, 2006, 2008, 2009,
-2010, 2011, 2012 Russ Allbery <rra@stanford.edu> and Zenin.  This program
-is free software; you may redistribute it and/or modify it under the same
-terms as Perl itself.
-
-PUSHCOLOR, POPCOLOR, and LOCALCOLOR were contributed by openmethods.com
-voice solutions.
-
-=cut
@@ -0,0 +1,42 @@
+#!/usr/bin/perl
+#
+# Build script for the Term::ANSIColor distribution.
+#
+# Copyright 1997, 1998, 2000, 2009, 2011, 2012, 2013, 2014
+#     Russ Allbery <rra@cpan.org>
+#
+# This program is free software; you may redistribute it and/or modify it
+# under the same terms as Perl itself.
+
+use 5.006;
+use strict;
+use warnings;
+
+use Module::Build;
+
+# Basic package configuration.
+my $build = Module::Build->new(
+    module_name          => 'Term::ANSIColor',
+    dist_abstract        => 'Color output using ANSI escape sequences',
+    dist_author          => 'Russ Allbery <rra@cpan.org>',
+    dist_version_from    => 'lib/Term/ANSIColor.pm',
+    license              => 'perl',
+    recursive_test_files => 1,
+    create_makefile_pl   => 'traditional',
+
+    # Add additional package metadata.
+    meta_merge => {
+        resources => {
+            repository => 'git://git.eyrie.org/perl/ansicolor.git',
+            bugtracker =>
+'https://rt.cpan.org/Public/Dist/Display.html?Name=Term-ANSIColor',
+        },
+    },
+
+    # Other package relationships.
+    configure_requires => { 'Module::Build' => 0.28 },
+    requires           => { perl            => '5.006' },
+);
+
+# Generate the build script.
+$build->create_build_script;
@@ -1,372 +0,0 @@
-2012-03-18  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Version 3.02 released.
-
-	* ANSIColor.pm (AUTOLOAD): Only return pass-through behavior if
-	the function that was called was one of our constants, rather than
-	turning every unknown function in the Term::ANSIColor namespace
-	into a passthrough join function when colors are disabled.
-	* t/basic.t: Test proper error reporting with colors disabled.
-
-	* ANSIColor.pm (AUTOLOAD): Preserve an existing value of $@ when
-	generating a constant sub and restore it afterwards.  Diagnose
-	errors in creating the constant sub and die instead of ignoring
-	them.
-	* t/eval.t: New test for $@ preservation.
-
-	* ANSIColor.pm: Add italic and the ITALIC constant.  Document that
-	the support for it is rare.
-	* t/basic.t: Test italic and ITALIC support.
-
-	* ANSIColor.pm: Add "mistyped" as a stopword, required by the
-	latest aspell on Debian.
-
-2011-07-20  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Version 3.01 released.
-
-	* Makefile.PL: Change the DISTNAME to Term-ANSIColor.
-
-	* ANSIColor.pm (colored): Only interpret an initial array
-	reference as a list of colors, not any initial reference, allowing
-	the colored function to work properly on objects with
-	stringification defined.  Thanks, Revilo Reegiles.
-	* t/stringify.t: New test for proper behavior with non-array
-	references in colored.
-
-2011-03-13  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Fix two syntax errors in the SYNOPSIS.  Thanks,
-	Jan Hartung.
-
-2010-10-08  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Warn in the documentation that attributes are not
-	supported in and will not work with Perl formats.
-
-2010-04-11  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Update the URL for ECMA-048 in the documentation.
-
-2010-01-24  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Version 3.00 released.
-
-	* t/basic.t: Add some basic tests for bright color support.
-
-	* ANSIColor.pm: Reorganize the documentation and be clearer about
-	the function interface parameters.  Reword the explanation of
-	bright and regular colors, and provide some advice about which to
-	use.
-
-2010-01-24  Jakob Ilves  <illvilja@gmail.com>
-
-	* ANSIColor.pm: Add bright versions of the basic eight foreground
-	and background colors using the 9x and 10x codes, supported by
-	emulators with 16 color support.
-
-2009-08-30  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Version 2.02 released.
-
-	* ANSIColor.pm: Update compatibility matrix to reflect that xterm
-	now supports blink.
-
-	* ANSIColor.pm (colorvalid): New function to check whether an
-	attribute is known.
-	* t/basic.t: Test colorvalid.
-
-2009-07-04  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Add an example of checking color attributes by
-	catching exceptions from color() to the documentation.
-
-	* ANSIColor.pm: Add FAINT as a synonym for DARK and export it when
-	constants are requested.
-	* t/basic.t: Test faint and FAINT as a synonym for dark/DARK.
-
-	* ANSIColor.pm: Version 2.01 released.
-
-	* t/basic.t: Test error handling in color, colored, and uncolor.
-
-	* ANSIColor.pm (uncolor): When reporting errors for bad escape
-	sequences, don't include the leading \e[ or trailing m in the
-	error message.
-
-	* ANSIColor.pm: Add section headings to the DESCRIPTION section of
-	the module since it's getting rather long.
-	(colorstrip): New function to remove ANSI color codes from
-	strings.  Thanks, Paul Miller.
-	* t/basic.t: New tests for colorstrip.
-
-	* ANSIColor.pm (AUTOLOAD): Untaint $AUTOLOAD, required by Perl
-	5.10 when running in taint mode.  Thanks, Tim Bellinghausen.
-	* t/basic.t: Two new tests for AUTOLOAD error handling.  Enable
-	warnings and taint mode.
-
-2009-02-28  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Version 2.00 released.
-
-	* Makefile.PL: Add LICENSE to the distribution metadata for Perl
-	5.10 and later.
-
-	* ANSIColor.pm: Add explicit return statements instead of relying
-	on the implicit return of the last expression.  Use all caps for
-	all global variables.
-
-	* ANSIColor.pm: Add the new functions to a :pushpop export tag.
-	(PUSHCOLOR): New function that stores in an internal stack the
-	attributes that are being set.
-	(POPCOLOR): New function that pops the attributes being set and
-	sets the attributes previously found on the stack.
-	(LOCALCOLOR): New function that surrounds its argument in
-	PUSHCOLOR and POPCOLOR.
-	(AUTOLOAD): If $AUTOLOCAL is set, surround all color constants
-	with an implicit LOCALCOLOR.
-	* t/basic.t: Test PUSHCOLOR, POPCOLOR, and LOCALCOLOR.
-
-	* t/pod-spelling.t: Rewrite to use Test::More.  Support and prefer
-	aspell.
-
-	* ANSIColor.pm: Fix additional spelling errors and rewrap the POD
-	documentation to a 74-character margin.
-
-	* t/basic.t: Rewrite to use Test::More.
-	* t/pod.t: Likewise.
-
-	* ANSIColor.pm (AUTOLOAD): If ANSI_COLORS_DISABLED is set, return
-	the stringified arguments rather than creating a sub.  This allows
-	colors to work later if ANSI_COLORS_DISABLED is unset rather than
-	making its effects permanent.  It also avoids adding a reset
-	escape sequence when $AUTORESET and ANSI_COLORS_DISABLED are both
-	set.
-
-2008-09-14  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Add faint as a synonym for dark and improve the
-	documentation of text attributes.
-
-	* t/pod-spelling.t: New check to spell-check POD documentation
-	using ispell with Pod::Spell.
-	* ANSIColor.pm: Fix spelling and markup errors in documentation
-	and add stop-words where appropriate.
-
-2007-04-22  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Version 1.12 released.
-
-2007-03-23  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Use the right syntax for internal POD links.
-	Thanks, Rafael Garcia-Suarez.
-
-2007-02-10  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Add cyan and white to the list of supported
-	attributes.  Not sure how I managed to omit them before.
-
-2006-07-12  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Version 1.11 released.
-
-2006-06-22  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Clarify in the documentation the behavior of
-	terminals when background colors are set across newlines, and
-	rewrite some of the examples to avoid doing things that confuse
-	the terminal.  Fix a couple of spelling errors.
-
-	* test.pl: Moved to...
-	* t/basic.t: ...here.
-	* t/pod.t: New test for POD validity.
-
-2005-08-21  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Version 1.10 released.
-
-	* ANSIColor.pm (colored): Fix the $EACHLINE support to work
-	properly with a line consisting solely of "0".  Remove Zenin's
-	now-defunct e-mail address from the documentation.
-	* test.pl: Test 0 and the empty string in combination with
-	$EACHLINE.
-
-	* tests/ansicolor: Add terminal test file from Joe Smith.
-	* tests/vt100-torture: Likewise.
-	* tests/README: Add an explanation of the test files.
-
-2004-12-03  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Version 1.09 released.
-
-	* ANSIColor.pm: Add compatibility information for Mac OS X
-	Terminal from Daniel Lindsley.
-
-2004-02-20  Russ Allbery  <rra@stanford.edu>
-
-	* test.pl: Always use eq, not ==, for string comparisons.
-
-2004-02-19  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Version 1.08 released.
-
-	* ANSIColor.pm: Add DARK to %EXPORT_TAGS and add CYAN and WHITE to
-	the list of documented constants.
-	* test.pl: Add a test for DARK.  Redo the leading comment.
-
-2003-03-25  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Version 1.07 released.
-
-	* ANSIColor.pm: Add PuTTY, Windows telnet, and Cygwin OpenSSH
-	information to the terminal emulators table, and update the URL to
-	the ECMA standard.
-
-2002-12-09  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Version 1.06 released to synchronize the version
-	on CPAN with the version in Perl core.
-
-	* ANSIColor.pm: Fix typo in L<> link in documentation.
-
-2002-06-28  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Version 1.05 released.
-
-	* ANSIColor.pm: Update the formatting style, add a pointer to the
-	module web site, use L<> for URLs, and use naked <>s where
-	permissible rather than E<lt> and E<gt>.  Renamed LICENSE to
-	COPYRIGHT AND LICENSE.
-
-2002-02-14  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Added a mention of the specific Windows consoles
-	that don't work with this module.
-
-2001-07-10  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Version 1.04 released.
-
-	* ANSIColor.pm: Add documentation, examples, and diagnostics for
-	uncolor.  Document ANSI_COLORS_DISABLED.  Add information about
-	the relevant standards for these escape sequences and the
-	additional ones that aren't supported by this module.  Add a
-	pointer to the relevant standards.  Add a LICENSE section.  Update
-	Zenin's e-mail address.
-
-	* ANSIColor.pm (AUTOLOAD): Add support for ANSI_COLORS_DISABLED.
-	(color): Likewise.
-	(colored): Likewise.
-	* test.pl: Add tests for ANSI_COLORS_DISABLED.
-
-	* ANSIColor.pm (uncolor): New function.
-	* test.pl: Add a test for it.
-
-2000-08-06  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Version 1.03 released.
-
-	* Makefile.PL: Install in the Perl library directory for Perl
-	versions >= 5.6.0.
-
-	* test.pl: Added a new test for the array reference syntax for
-	colored.
-
-	* ANSIColor.pm: Changed $VERSION to a static string.  Added dark
-	to the attributes.  Updated the documentation to include a table
-	of supported attributes on different terminal emulators, to add
-	dark, to document the new optional way to call colored, and to
-	mark the diagnostics as fatal errors or warnings.
-	(colored): Allow the attributes to be passed as an initial array
-	reference as well as a final list, and for that calling syntax
-	take the rest of the arguments as text to be colored.
-
-1998-11-27  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Version 1.02 released.
-
-	* Makefile.PL: Added a 5.005-only section giving ABSTRACT and
-	AUTHOR settings for generating a PPD to go with a binary
-	distribution or the Perl Resource Kits.
-
-1998-04-14  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: croak() instead of die() on AUTOLOAD failure to
-	get the right error text, fixed a bunch of typos in the
-	documentation, added a quote.
-
-1997-12-10  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Version 1.01 released.
-
-	* ANSIColor.pm (color): Carp::croak() isn't predeclared, so it
-	needs parens around its argument.  This bug will only show up in
-	versions of Perl >5.004_04 since up until then strict.pm imports
-	Carp which predeclares the function.
-
-1997-11-29  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Version 1.00 released.
-
-	* Makefile.PL: Now gets version information from the module, has
-	the correct rules to build a distribution.
-
-	* test.pl: Comments trimmed, minor test modifications.
-
-	* ANSIColor.pm: Changed my e-mail address, fixed to deal correctly
-	with trailing delimiters when EACHLINE is being used, die()
-	changed to croak() if the caller uses an invalid attribute name,
-	getting $VERSION from RCS updated to my current method, source
-	detabified.
-
-	* test.pl: Added test for EACHLINE with trailing delimiters.
-
-1997-02-17  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Version 0.9 released.
-
-	* ANSIColor.pm: Changed the runtime error message to start with an
-	uppercase letter, reworked the documentation considerably
-	including adding more comparison between the two interfaces,
-	fixing some formatting bugs, fixing a typo, adding more
-	diagnostics, and generally being more verbose.
-
-1997-01-08  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: Version 0.8 released.
-
-	* test.pl: Fixed the test numbering in the BEGIN block.
-
-	* test.pl: Reformatted and commented to fit my programming style.
-
-	* ANSIColor.pm: Changed the method by which $VERSION is set so
-	that it will always have two digits after the decimal point.
-
-	* test.pl: New file.
-
-	* ANSIColor.pm: [Revision 0.7] Changed the codes so that reset is
-	always consistantly "\e[0m".
-
-	* ANSIColor.pm: [Revision 0.6] Added $EACHLINE and support to
-	colored() for it so that attributes can be reset around every
-	newline (or other line delimiter -- we're flexible).  Documented
-	this as well.
-
-	* ANSIColor.pm: [Revision 0.5] Changed implementation of the
-	constants to autoloaded subs, added the $AUTORESET variable for
-	use with the constants, and documented this.
-
-1996-12-07  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: [Revision 0.4] Added POD documentation.
-
-	* ANSIColor.pm: [Revision 0.3] Added constant forms, modified to
-	allow a space-separated string of attributes to be passed to
-	color() and colored(), added Zenin to the credits.
-
-1996-12-04  Russ Allbery  <rra@stanford.edu>
-
-	* ANSIColor.pm: [Revision 0.2] Changed return syntax and check for
-	the null attribute string.
-
-	* ANSIColor.pm: New file.
@@ -0,0 +1,47 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Comment: This file documents the copyright statements and licenses for
+ every file in this package in a machine-readable format.  For a less
+ detailed, higher-level overview, see README.
+ .
+ For any copyright year range specified as YYYY-ZZZZ in this file, the
+ range specifies every single year in that closed interval.
+
+Files: *
+Copyright: 1996 Zenin
+  1996-1998, 2000-2002, 2005-2006, 2008-2014 Russ Allbery <rra@cpan.org>
+  2011 Revilo Reegiles
+  2012 Stephen Thirlwall
+  2012 Kurt Starsinic <kstarsinic@gmail.com>
+License: Perl
+ This program is free software; you may redistribute it and/or modify it
+ under the same terms as Perl itself.  This means that you may choose
+ between the two licenses that Perl is released under:  the GNU GPL and the
+ Artistic License.  Please see your Perl distribution for the details and
+ copies of the licenses.
+
+Files: t/data/perlcriticrc t/docs/pod-coverage.t t/docs/pod-spelling.t
+ t/docs/pod.t t/docs/synopsis.t t/lib/Test/RRA.pm t/lib/Test/RRA/Config.pm
+ t/style/coverage.t t/style/critic.t t/style/minimum-version.t
+ t/style/strict.t
+Copyright: 2011-2014
+    The Board of Trustees of the Leland Stanford Junior University
+License: Expat
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to permit
+ persons to whom the Software is furnished to do so, subject to the
+ following conditions:
+ .
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
+ OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
@@ -1,14 +1,32 @@
-ANSIColor.pm
-ChangeLog
-Makefile.PL
-MANIFEST
+.gitignore
+Build.PL
+examples/generate-colors
+lib/Term/ANSIColor.pm
+LICENSE
+MANIFEST			This list of files
+MANIFEST.SKIP
+NEWS
 README
-t/basic.t
-t/eval.t
-t/pod-spelling.t
-t/pod.t
-t/stringify.t
-tests/ansicolor
-tests/README
-tests/vt100-torture
-META.yml                                 Module meta-data (added by MakeMaker)
+t/data/perl.conf
+t/data/perlcriticrc
+t/data/perltidyrc
+t/docs/pod-coverage.t
+t/docs/pod-spelling.t
+t/docs/pod.t
+t/docs/synopsis.t
+t/lib/Test/RRA.pm
+t/lib/Test/RRA/Config.pm
+t/module/aliases-env.t
+t/module/aliases-func.t
+t/module/basic.t
+t/module/basic256.t
+t/module/eval.t
+t/module/stringify.t
+t/style/coverage.t
+t/style/critic.t
+t/style/minimum-version.t
+t/style/strict.t
+t/taint/basic.t
+Makefile.PL
+META.yml
+META.json
@@ -0,0 +1,41 @@
+# -*- conf -*-
+
+# Avoid version control files.
+^\.git/
+
+# Avoid generated build files.
+\bblib/
+
+# Avoid Module::Build generated and utility files.
+\bBuild$
+\b_build/
+\bBuild.bat$
+\bBuild.COM$
+\bBUILD.COM$
+\bbuild.com$
+
+# Avoid temp and backup files.
+~$
+\.old$
+\#$
+\b\.#
+\.bak$
+\.tmp$
+\.#
+\.rej$
+
+# Avoid OS-specific files/dirs
+# Mac OSX metadata
+\B\.DS_Store
+# Mac OSX SMB mount metadata files
+\B\._
+
+# Avoid Devel::Cover and Devel::CoverX::Covered files.
+\bcover_db\b
+\bcovered\b
+
+# Avoid MYMETA files
+^MYMETA\.
+
+# Avoid archives of this distribution
+\bTerm-ANSIColor-[\d\.\_]+
@@ -0,0 +1,47 @@
+{
+   "abstract" : "Color output using ANSI escape sequences",
+   "author" : [
+      "Russ Allbery <rra@cpan.org>"
+   ],
+   "dynamic_config" : 1,
+   "generated_by" : "Module::Build version 0.4205",
+   "license" : [
+      "perl_5"
+   ],
+   "meta-spec" : {
+      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+      "version" : "2"
+   },
+   "name" : "Term-ANSIColor",
+   "prereqs" : {
+      "configure" : {
+         "requires" : {
+            "Module::Build" : "0.28"
+         }
+      },
+      "runtime" : {
+         "requires" : {
+            "perl" : "5.006"
+         }
+      }
+   },
+   "provides" : {
+      "Term::ANSIColor" : {
+         "file" : "lib/Term/ANSIColor.pm",
+         "version" : "4.03"
+      }
+   },
+   "release_status" : "stable",
+   "resources" : {
+      "bugtracker" : {
+         "web" : "https://rt.cpan.org/Public/Dist/Display.html?Name=Term-ANSIColor"
+      },
+      "license" : [
+         "http://dev.perl.org/licenses/"
+      ],
+      "repository" : {
+         "url" : "git://git.eyrie.org/perl/ansicolor.git"
+      }
+   },
+   "version" : "4.03"
+}
@@ -1,21 +1,25 @@
---- #YAML:1.0
-name:               Term-ANSIColor
-version:            3.02
-abstract:           Color output using ANSI escape sequences
+---
+abstract: 'Color output using ANSI escape sequences'
 author:
-    - Russ Allbery (rra@stanford.edu)
-license:            perl
-distribution_type:  module
+  - 'Russ Allbery <rra@cpan.org>'
+build_requires: {}
 configure_requires:
-    ExtUtils::MakeMaker:  0
-build_requires:
-    ExtUtils::MakeMaker:  0
-requires:  {}
-no_index:
-    directory:
-        - t
-        - inc
-generated_by:       ExtUtils::MakeMaker version 6.57_05
+  Module::Build: '0.28'
+dynamic_config: 1
+generated_by: 'Module::Build version 0.4205, CPAN::Meta::Converter version 2.133380'
+license: perl
 meta-spec:
-    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
-    version:  1.4
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: '1.4'
+name: Term-ANSIColor
+provides:
+  Term::ANSIColor:
+    file: lib/Term/ANSIColor.pm
+    version: '4.03'
+requires:
+  perl: '5.006'
+resources:
+  bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Term-ANSIColor
+  license: http://dev.perl.org/licenses/
+  repository: git://git.eyrie.org/perl/ansicolor.git
+version: '4.03'
@@ -1,17 +1,16 @@
-# Makefile.PL for Term::ANSIColor.
-
+# Note: this file was auto-generated by Module::Build::Compat version 0.4205
+require 5.006;
 use ExtUtils::MakeMaker;
-
-WriteMakefile (
-    NAME          => 'Term::ANSIColor',
-    DISTNAME      => 'Term-ANSIColor',
-    ($] >= 5.006 ?
-     (INSTALLDIRS => 'perl') : ()),
-    ($] >= 5.005 ?
-     (ABSTRACT    => 'Color output using ANSI escape sequences',
-      AUTHOR      => 'Russ Allbery (rra@stanford.edu)') : ()),
-    ($] >= 5.010 ?
-     (LICENSE     => 'perl') : ()),
-    VERSION_FROM  => 'ANSIColor.pm',
-    dist          => { COMPRESS => 'gzip', SUFFIX => 'gz' }
-);
+WriteMakefile
+(
+  'NAME' => 'Term::ANSIColor',
+  'VERSION_FROM' => 'lib/Term/ANSIColor.pm',
+  'PREREQ_PM' => {},
+  'INSTALLDIRS' => 'site',
+  'EXE_FILES' => [],
+  'PL_FILES' => {},
+  'test' => {
+              'TESTS' => 't/*.t t/taint/*.t t/lib/*.t t/lib/Test/*.t t/lib/Test/RRA/*.t t/docs/*.t t/style/*.t t/module/*.t t/data/*.t'
+            }
+)
+;
@@ -0,0 +1,247 @@
+                   User-Visible Term::ANSIColor Changes
+
+Term::ANSIColor 4.03 (2014-03-23)
+
+    Switch the module build system to Module::Build, but still generate a
+    Makefile.PL file for backward compatibility and for the use of Perl
+    core.
+
+    Fix typo in SYNOPSIS (colorstrip example) and duplicated word.
+    Thanks, Olivier Mengué and David Steinbrunner.  (#85480, #94006)
+
+    Skip POD and some other style tests unless doing automated or release
+    testing.  Skip POD spelling, coverage, and Perl::Critic tests unless
+    doing author testing.  Use the Lancaster Consensus environment
+    variables instead of RRA_MAINTAINER_TESTS.  (#93474)
+
+    Add SEE ALSO reference to Win32::Console::ANSI.  (#87295)
+
+Term::ANSIColor 4.02 (2013-01-07)
+
+    When testing 256-color support, list the tag first in the import list
+    for compatibility with the Exporter from Perl 5.6.2.  Thanks to David
+    Cantrell for the testing and debugging.
+
+    Add the minimum Perl version to the package metadata.
+
+Term::ANSIColor 4.01 (2012-12-31)
+
+    Fix logic for skipping tests when Test::Warn is not installed.
+
+Term::ANSIColor 4.00 (2012-12-30)
+
+    Add constants (with tag :constants256) and attributes for 256-color
+    emulators.  Thanks, Kurt Starsinic.
+
+    Add support for custom color names configured with either a new
+    function, coloralias, or the ANSI_COLORS_ALIASES environment variable
+    as set during module load.  Thanks, Stephen Tirlwall.
+
+    Only honor ANSI_COLORS_DISABLED if it is set to a true value.
+
+    The module now requires Perl 5.6 or later and makes use of Perl 5.6
+    features.
+
+    Replace the AUTOLOAD support for ANSI_COLORS_DISABLED with generation
+    of constant subs that check for ANSI_COLORS_DISABLED when they're
+    called.  This fixes behavior if the constant were used before the
+    environment variable was set and then used again afterwards.
+
+    PUSHCOLOR now takes an array like all the other constant functions and
+    joins all arguments together before manipulating them, making behavior
+    more consistent in some edge cases.
+
+    $AUTOLOCAL now takes precedence over $AUTORESET, reversing the
+    previous behavior.  It is also now properly documented.
+
+    Add a COMPATIBILITY section to the documentation collecting all
+    information about when features were introduced and adding the version
+    of Perl that they shipped with.  Add appropriate version numbers to
+    the use statements in the SYNOPSIS.
+
+    Add a new generate-colors example script that can generate various
+    test and demonstration files, including for 256 colors and various
+    attributes.  Remove the VT100 test files, which had an unclear
+    license.  generate-colors can now generate better tests for everything
+    of significance to this package.
+
+Term::ANSIColor 3.02 (2012-03-18)
+
+    In AUTOLOAD, only return pass-through behavior if the function that
+    was called was one of our constants, rather than turning every unknown
+    function in the Term::ANSIColor namespace into a passthrough join
+    function when colors are disabled.
+
+    Add the italic attribute and the ITALIC constant.  Document that
+    support for it is rare.
+
+    Preserve an existing value of $@ when generating a constant sub and
+    restore it afterwards.  Diagnose errors in creating the constant sub
+    and die instead of ignoring them.
+
+Term::ANSIColor 3.01 (2011-07-20)
+
+    In colored, only interpret an initial array reference as a list of
+    colors, not any initial reference, allowing the colored function to
+    work properly on objects with stringification defined.  Thanks, Revilo
+    Reegiles.
+
+    Warn in the documentation that attributes are not supported in and
+    will not work with Perl formats.
+
+Term::ANSIColor 3.00 (2010-01-04)
+
+    Add bright versions of the basic eight foreground and background
+    colors using the 9x and 10x codes, supported by emulators with 16
+    color support.
+
+    Reword the explanation of bright and regular colors, and provide some
+    advice about which to use.
+
+    Reorganize the documentation and be clearer about the function
+    interface parameters.
+
+Term::ANSIColor 2.02 (2009-08-30)
+
+    Add the new function colorvalid, which takes an attribute and returns
+    whether it's a known attribute.
+
+    Add FAINT as a synonym for DARK and export it when constants are
+    requested.
+
+    Update the terminal compatibility matrix to reflect that xterm now
+    supports blink.
+
+Term::ANSIColor 2.01 (2009-07-04)
+
+    Add the new function colorstrip, which removes ANSI color codes from
+    strings.  Thanks, Paul Miller.
+
+    When reporting errors for bad escape sequences in uncolor, don't
+    include the leading \e[ or trailing m in the error message.
+
+    Untaint $AUTOLOAD when generating constant subs, which is required by
+    Perl 5.10 and later running in taint mode.  Thanks, Tim Bellinghausen.
+
+Term::ANSIColor 2.00 (2009-02-28)
+
+    Add new functions PUSHCOLOR, POPCOLOR, and LOCALCOLOR, which maintain
+    a stack of colors using the constant syntax.  PUSHCOLOR stores the
+    attributes being set on its internal stack, POPCOLOR returns to the
+    previous attribute set, and LOCALCOLOR surrounds its argument in
+    PUSHCOLOR and POPCOLOR.  If $AUTOLOCAL is set, each sequence of color
+    constants will be implicitly preceded by LOCALCOLOR.  This support was
+    contributed by openmethods.com voice solutions.
+
+    When AUTOLOAD is called to generate a constant sub and the environment
+    variable ANSI_COLORS_DISABLED is set, return the stringified arguments
+    rather than creating a sub.  This allows colors to work later if
+    ANSI_COLORS_DISABLED is unset rather than making its effects
+    permanent.  It also avoids adding a reset escape sequence when
+    $AUTORESET and ANSI_COLORS_DISABLED are both set.
+
+    Add faint as a synonym for dark.
+
+    Fix spelling and markup errors in the documentation and improve the
+    documentation of text attributes.
+
+Term::ANSIColor 1.12 (2007-04-22)
+
+    Use the correct syntax for internal POD links in the documentation.
+
+    Document cyan and white as supported attributes.
+
+Term::ANSIColor 1.11 (2006-06-22)
+
+    Clarify in the documentation the behavior of terminals when background
+    colors are set across newlines, and rewrite some of the examples to
+    avoid doing things that confuse the terminal.
+
+Term::ANSIColor 1.10 (2005-08-21)
+
+    Fix $EACHLINE handling of lines consisting solely of "0".
+
+    Add terminal test files from Joe Smith to the distribution.
+
+Term::ANSIColor 1.09 (2004-12-03)
+
+    Add compatibility information for Mac OS X Terminal to the terminal
+    emulators table.  Thanks, Daniel Lindsley.
+
+Term::ANSIColor 1.08 (2004-02-19)
+
+    Export DARK as a constant.  This was missed when dark was added as a
+    supported attribute.
+
+Term::ANSIColor 1.07 (2003-03-25)
+
+    Document the behavior of PuTTY, Windows telnet, and Cygwin OpenSSH in
+    the terminal emulators table.
+
+    Update the URL to the ECMA standard.
+
+Term::ANSIColor 1.06 (2002-12-09)
+
+    Fix a typo in an L<> link in the documentation.
+
+Term::ANSIColor 1.05 (2002-06-28)
+
+    Document the Windows consoles that don't work with this module.
+
+    Update the documentation formatting style.
+
+Term::ANSIColor 1.04 (2001-07-10)
+
+    Add a new uncolor function, which takes a set of escape sequences and
+    returns a list of attribute names set by those escape sequences.  This
+    is the opposite function as color.
+
+    If ANSI_COLORS_DISABLED is set in the environment, all of the
+    functions and constants in this module become no-ops that pass through
+    text without coloring it.
+
+    Add information about the relevant standards to the documentation.
+
+Term::ANSIColor 1.03 (2000-08-06)
+
+    In the colored function, allow the attributes to be passed as an
+    initial array reference as well as a trailing list.  When called with
+    that syntax, all subsequent arguments are taken as text to be colored.
+
+    Add the dark attribute.
+
+    Improve the documentation by including a table of supported attributes
+    on different terminal emulators in the documentation and documenting
+    whether diagnostics are fatal errors or warnings.
+
+    Install into the Perl library directory for Perl 5.6.0 or later, since
+    this module is now part of core.
+
+Term::ANSIColor 1.02 (1998-11-27)
+
+    Call croak instead of die if the AUTOLOAD function to synthesize
+    constants fails.
+
+    Set ABSTRACT and AUTHOR in Makefile.PL to support PPD generation for
+    binary distributions or the Perl Resource Kits.
+
+Term::ANSIColor 1.01 (1997-12-10)
+
+    Fix the call to carp when running under Perl versions later than
+    5.004_04, which no longer import Carp in strict.pm and thereby declare
+    the function at compile time.
+
+Term::ANSIColor 1.00 (1997-11-29)
+
+    Correctly handle trailing delimiters when $EACHLINE is set.
+
+    Call croak instead of die if a caller uses an invalid attribute name,
+    since the error is really at the call site.
+
+    Add the correct rules to Makefile.PL to build a distribution.
+
+Term::ANSIColor 0.09 (1997-02-17)
+
+    Initial public release.  (Possibly.  It's the oldest version available
+    on BackPan and dates back to when the "package" version was based on
+    the RCS revision of the ANSIColor.pm file.)
@@ -1,75 +1,94 @@
-                       Term::ANSIColor version 3.02
+                           Term::ANSIColor 4.03
               (A simple ANSI text attribute control module)
 
-  Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2005, 2006, 2007, 2009,
-  2010, 2011, 2012 Russ Allbery <rra@stanford.edu> and Zenin.  This
-  program is free software; you may redistribute it and/or modify it under
-  the same terms as Perl itself.
-
-  I welcome bug reports and patches for this package at rra@stanford.edu
-  or via the CPAN bug tracker at <http://rt.cpan.org/>.  However, please
-  be aware that I tend to be extremely busy and to get a lot of mail.
-  I'll save your mail and get to it as soon as I can, but depending on how
-  busy I am it may take me a couple of months.
+  This program is free software; you may redistribute it and/or modify it
+  under the same terms as Perl itself.  Please see the section LICENSE
+  below for more information.
 
 BLURB
 
-  Term::ANSIColor provides constants and simple functions for sending ANSI
+  Term::ANSIColor provides constants and simple functions for setting ANSI
   text attributes, most notably colors.  It can be used to set the current
   text attributes or to apply a set of attributes to a string and reset
-  the current text attributes at the end of that string.
+  the current text attributes at the end of that string.  Eight-color,
+  sixteen-color, and 256-color escape sequences are all supported.
 
 DESCRIPTION
 
-  This module grew out of a thread on comp.lang.perl.misc where several of
-  us were throwing around different ways to print colored text from Perl
-  scripts and Zenin posted his old library to do that.  I (Russ) disagreed
-  with the implementation and offered my own (the color() and colored()
-  functions implemented in this package), Zenin convinced me that the
-  constants had their place as well, and we started figuring out the best
-  ways of implementing both.
-
-  While ANSI color escape codes are fairly simple, it can be hard to
-  remember the codes for all of the attributes and the code resulting from
-  hard-coding them into your script is definitely difficult to read.  This
-  module is designed to fix those problems, as well as provide a
-  convenient interface to do a few things for you automatically (like
-  resetting attributes after the text you print out so that you don't
-  accidentally leave attributes set).
-
-  Despite its name, this module can also handle non-color ANSI text
-  attributes (bold, underline, reverse video, and blink).  It uses either
-  of two interfaces, one of which uses "constants" for each different
-  attribute and the other of which uses two subs which take strings of
-  attributes as arguments.
+  This Perl module is a simple and convenient interface to the ANSI
+  terminal escape sequences for color (from ECMA-48, also included in ISO
+  6429).  The color sequences are provided in two forms, either as
+  constants for each color or via a function that takes the names of
+  colors and returns the appropriate escape codes or wraps them around the
+  provided text.  The non-color text style codes from ANSI X3.64 (bold,
+  dark, underline, and reverse, for example), which were also included in
+  ECMA-48 and ISO 6429, are also supported.  Also supported are the
+  extended colors used for sixteen-color and 256-color emulators.
+
+  This module is very stable, and I've used it in a wide variety of
+  applications.  It has been included in the core Perl distribution
+  starting with version 5.6.0, so you don't need to download and install
+  it yourself unless you have an old version of Perl or need a newer
+  version of the module than comes with your version of Perl.  I continue
+  to maintain it as a separate module, and the version included in Perl is
+  resynced with mine before each release.
+
+  The original module came out of a discussion in comp.lang.perl.misc and
+  is a combination of two approaches, one with constants by Zenin and one
+  with functions that I wrote.  I offered to maintain a combined module
+  that included both approaches.
 
   See the POD documentation for complete details, features, and usage.
 
-  This module is distributed as part of the Perl core distribution as of
-  Perl 5.6.0.  You only need to install this module if you want a newer
-  version than came with Perl or if you have an old version of Perl.
-
 REQUIREMENTS
 
   Term::ANSIColor is written in pure Perl and has no module dependencies
   that aren't found in Perl core.  It should work with any version of Perl
-  after 5.001, although it hasn't been tested with old versions in some
+  after 5.6, although it hasn't been tested with old versions in some
   time.
 
-  The test suite requires the Test::More module.  To check the POD
-  documentation, Test::Pod is also required.  To check spelling,
-  Pod::Spell and either aspell or ispell with the american dictionary are
-  also required.  The user's path is searched for aspell or ispell and
-  aspell is preferred.  Spelling tests are disabled by default since
-  spelling dictionaries differ too much between systems.  To enable those
-  tests, set RRA_MAINTAINER_TESTS to a true value.
+  In order to actually see color, you will need to use a terminal window
+  that supports the ANSI escape sequences for color.  Any recent version
+  of xterm, most xterm derivatives and replacements, and most telnet and
+  ssh clients for Windows and Macintosh should work, as will the MacOS X
+  Terminal application (although Terminal.app reportedly doesn't support
+  256 colors).  The console windows for Windows NT and Windows 2000 will
+  not work, as they do not even attempt to support ANSI X3.64.
+
+  For a complete (to my current knowledge) compatibility list, see the
+  Term::ANSIColor module documentation.  If you have any additions to the
+  table in the documentation, please send them to me.
+
+  The test suite requires Perl and Test::More (part of Perl since 5.6.2).
+  It also makes use Test::Warn if it is available, but skips the relevant
+  tests if that module is not installed.
+
+  To enable tests that don't detect functionality problems but are used to
+  sanity-check the release, set the environment variable RELEASE_TESTING
+  to a true value.  To enable tests that may be sensitive to the local
+  environment or that produce a lot of false positives without uncovering
+  many problems, set the environment variable AUTHOR_TESTING to a true
+  value.  For these tests, the additional Perl modules:
+
+      Devel::Cover
+      Perl::Critic
+      Test::MinimumVersion
+      Test::Perl::Critic
+      Test::Pod
+      Test::Pod::Coverage
+      Test::Spelling
+      Test::Strict
+      Test::Synopsis
+
+  and their dependencies as well as a spell-checking program (several are
+  supported by Test::Spelling) are required.  These modules are all
+  available from CPAN.
 
 INSTALLATION
 
   WARNING: Installation of this package will replace the Term::ANSIColor
-  that came with Perl for Perl 5.6.0 or later.  Term::ANSIColor that came
-  with Perl.  You may want to save a backup copy of the standard version
-  first.
+  that came with Perl.  You may want to save a backup copy of the standard
+  version first.
 
   Follow the standard installation procedure for Perl modules, which is to
   type the following commands:
@@ -83,7 +102,7 @@ INSTALLATION
   install the module by hand, simply copy it into a directory named Term
   in your Perl library directory.
 
-HOMEPAGE AND SOURCE REPOSITORY
+SUPPORT
 
   The Term::ANSIColor web page at:
 
@@ -92,6 +111,18 @@ HOMEPAGE AND SOURCE REPOSITORY
   will always have the current version of this package, the current
   documentation, and pointers to any additional resources.
 
+  For bug tracking, this package uses the CPAN bug tracker at:
+
+      https://rt.cpan.org/Public/Dist/Display.html?Name=Term-ANSIColor
+
+  I welcome bug reports and patches for this package at rra@cpan.org
+  or via the CPAN bug tracker.  However, please be aware that I tend to be
+  extremely busy and work projects often take priority.  I'll save your
+  mail and get to it as soon as I can, but it may take me a couple of
+  months.
+
+SOURCE REPOSITORY
+
   Term::ANSIColor is maintained using Git.  You can access the current
   source by cloning the repository at:
 
@@ -101,11 +132,8 @@ HOMEPAGE AND SOURCE REPOSITORY
 
       http://git.eyrie.org/?p=perl/ansicolor.git
 
-  For bug tracking, this package uses the CPAN bug tracker at:
-
-      https://rt.cpan.org/
-
-  Look for the Term-ANSIColor distribution.
+  When contributing modifications, patches (possibly generated by
+  git-format-patch) are preferred to Git pull requests.
 
 THANKS
 
@@ -137,8 +165,9 @@ THANKS
   To Daniel Lindsley for the information about what Mac OS X Terminal
   supports.
 
-  To Joe Smith for the test files that exercise a wide variety of VT100
-  escape sequences including the ECMA-48 color control codes.
+  To Joe Smith for the original test files that exercise a wide variety of
+  VT100 escape sequences including the ECMA-48 color control codes.  These
+  have been replaced by an example script, but they were very useful.
 
   To James Bowlin for catching a bug in colored when $EACHLINE is set that
   caused it to not color lines consisting solely of 0.
@@ -172,4 +201,50 @@ THANKS
   To Simon Wistow for reporting that Term::ANSIColor was inadvertantly
   clobbering $@ when generating constant subs.
 
+  To Kurt Starsinic for the initial implementation of 256-color support.
+
+  To Magnus Woldrich for Term::ExtendedColor and for research on which
+  emulators support 256 colors.
+
+  To Stephen Thirlwall for the initial implementation of custom color
+  support.
+
+  To BlueT - Matthew Lien - 練喆明 for quick testing of 4.00 and reporting
+  a problem with skipping one of the tests.
+
+  To David Cantrell for testing with Perl 5.6.2 and debugging why a test
+  case didn't work with its version of Exporter.
+
+  To Olivier Mengué for fixing a SYNOPSIS quoting error and for various
+  other build fixes and recommendations about environment variables for
+  test control.
+
   To Larry Wall, as always, for Perl.
+
+LICENSE
+
+  The Term-ANSIColor distribution as a whole is covered by the following
+  copyright statement and license:
+
+    Copyright 1996 Zenin
+    Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2005, 2006, 2008, 2009,
+        2010, 2011, 2012, 2013, 2014 Russ Allbery <rra@cpan.org>
+    Copyright 2012 Kurt Starsinic <kstarsinic@gmail.com>
+
+    This program is free software; you may redistribute it and/or modify
+    it under the same terms as Perl itself.  This means that you may
+    choose between the two licenses that Perl is released under: the GNU
+    GPL and the Artistic License.  Please see your Perl distribution for
+    the details and copies of the licenses.
+
+    PUSH/POP support submitted 2007 by openmethods.com voice solutions
+
+  All individual files without an explicit exception below are released
+  under this license.  Some files may have additional copyright holders as
+  noted in those files.  There is detailed information about the licensing
+  of each file in the LICENSE file in this distribution.
+
+  Some files in this distribution are individually released under
+  different licenses, all of which are compatible with the above general
+  package license but which may require preservation of additional
+  notices.  All required notices are preserved in the LICENSE file.
@@ -0,0 +1,298 @@
+#!/usr/bin/perl
+#
+# Generate 256-color test files.
+#
+# Takes one or more of six arguments: basic, bright, fg256 (foreground), bg256
+# (background), grey, or ansi256.  Generates a test file for either basic ANSI
+# colors or 256-color emulators, testing that region of colors.
+#
+# This script requires Term::ANSIColor 4.00 or later already be installed or
+# that this script be run manually under Perl with flags pointing to where the
+# module is.
+#
+# Copyright 2012 Kurt Starsinic <kstarsinic@gmail.com>
+# Copyright 2012, 2014 Russ Allbery <rra@cpan.org>
+#
+# This program is free software; you may redistribute it and/or modify it
+# under the same terms as Perl itself.
+
+use 5.006;
+use strict;
+use warnings;
+
+use Carp qw(croak);
+use Term::ANSIColor 4.00 qw(color);
+
+# Screen width for centering headings.
+use constant SCREEN_WIDTH => 80;
+
+# The basic attributes and eight colors.
+use constant ATTRIBUTES => qw(bold dark italic underline blink concealed);
+use constant COLORS     => qw(black red green yellow blue magenta cyan white);
+
+# print and printf with error checking.  autodie unfortunately can't help us
+# with these because they can't be prototyped and hence can't be overridden.
+
+## no critic (Subroutines::RequireArgUnpacking)
+sub print_checked  { print @_  or croak('print failed');  return }
+sub printf_checked { printf @_ or croak('printf failed'); return }
+## use critic
+
+# The sample background or foreground colors for 256-color tests.
+my @SAMPLES = qw(000 222 555);
+
+# The list of all possible RGB values.
+my @RGB;
+for my $r (0 .. 5) {
+    for my $g (0 .. 5) {
+        push(@RGB, map { "$r$g$_" } 0 .. 5);
+    }
+}
+
+# Center a text string with spaces.
+#
+# $text  - Text to center
+# $width - Width in which to center the text
+#
+# Returns: Text centered within that width
+sub center {
+    my ($text, $width) = @_;
+    my $padding  = $width - length($text);
+    my $trailing = int($padding / 2);
+    my $leading  = $padding - $trailing;
+    return (q{ } x $leading) . $text . (q{ } x $trailing);
+}
+
+# Print out the test file that tries all the basic eight ANSI colors.
+#
+# Returns: undef
+#  Throws: Text exception on I/O failure
+sub print_basic_test {
+    print_checked("Basic ANSI colors (eight-color, or dim)\n\n");
+    for my $bg (COLORS) {
+        printf_checked('%4s %-7s ', q{ }, $bg);
+        for my $fg (COLORS) {
+            print_checked(color($fg, "on_$bg"), center($fg, 8));
+        }
+        print_checked(color('reset'), "\n");
+        printf_checked('%4s %-7s ', 'bold', $bg);
+        for my $fg (COLORS) {
+            print_checked(color($fg, 'bold', "on_$bg"), center($fg, 8));
+        }
+        print_checked(color('reset'), "\n");
+    }
+    print_checked("\nAttributes: ");
+    for my $fg (ATTRIBUTES) {
+        print_checked(center($fg, 10));
+    }
+    print_checked("\n", q{ } x 12);
+    for my $fg (ATTRIBUTES) {
+        print_checked(color($fg), center('testing', 10), color('reset'));
+    }
+    print_checked("\n\n");
+    return;
+}
+
+# Print out the test file that tries all the bright colors from the
+# sixteen-color palette.
+#
+# Returns: undef
+#  Throws: Text exception on I/O failure
+sub print_bright_test {
+    print_checked("Bright ANSI colors (sixteen-color)\n\n");
+    for my $bg (COLORS) {
+        printf_checked('%6s %-7s ', 'dim', $bg);
+        for my $fg (COLORS) {
+            my $escape = color("bright_$fg", "on_$bg");
+            print_checked($escape, center($fg, 8));
+        }
+        print_checked(color('reset'), "\n");
+        printf_checked('%6s %-7s ', 'bright', $bg);
+        for my $fg (COLORS) {
+            my $escape = color("bright_$fg", "on_bright_$bg");
+            print_checked($escape, center($fg, 8));
+        }
+        print_checked(color('reset'), "\n");
+    }
+    print_checked("\n");
+    return;
+}
+
+# Print out the test file that tries all valid RGB foreground colors.
+#
+# Returns: undef
+#  Throws: Text exception on I/O failure
+sub print_fg256_test {
+    print_checked("RGB000 - RGB555 from 256-color palette (foreground)\n");
+    for my $bg (@SAMPLES) {
+        for my $i (0 .. $#RGB) {
+            if (($i % 18) == 0) {
+                printf_checked("%s\nbg %03d %s",
+                    color('reset'), $bg, color("on_rgb$bg"));
+            }
+            printf_checked('%s%03d ', color("rgb$RGB[$i]"), $RGB[$i]);
+        }
+    }
+    print_checked(color('reset'), "\n\n");
+    return;
+}
+
+# Print out the test file that tries all valid RGB background colors.
+#
+# Returns: undef
+#  Throws: Text exception on I/O failure
+sub print_bg256_test {
+    print_checked("RGB000 - RGB555 from 256-color palette (background)\n");
+    for my $fg (@SAMPLES) {
+        for my $i (0 .. $#RGB) {
+            if (($i % 18) == 0) {
+                printf_checked("%s\nfg %03d %s",
+                    color('reset'), $fg, color("rgb$fg"));
+            }
+            printf_checked('%s%03d ', color("on_rgb$RGB[$i]"), $RGB[$i]);
+        }
+    }
+    print_checked(color('reset'), "\n\n");
+    return;
+}
+
+# Print out the test file that shows all valid grey-scale colors.
+#
+# Returns: undef
+#  Throws: Text exception on I/O failure
+sub print_grey_test {
+    print_checked("Grey0 - Grey23 from 256-color palette\n\n");
+    for my $bg (0 .. 23) {
+        printf_checked('%2d %s', $bg, color("on_grey$bg"));
+        for my $fg (0 .. 23) {
+            printf_checked('%s%d ', color("grey$fg"), $fg);
+        }
+        print_checked(color('reset'), "\n");
+    }
+    print_checked("\n");
+    return;
+}
+
+# Print out the test file that shows the 16 ANSI colors from the 256-color
+# palette.
+#
+# Returns: undef
+#  Throws: Text exception on I/O failure
+sub print_ansi256_test {
+    print_checked("ANSI colors 0 - 15 from 256-color palette\n\n");
+    for my $bg (0 .. 15) {
+        printf_checked('%2d %s', $bg, color("on_ansi$bg"));
+        for my $fg (0 .. 15) {
+            printf_checked('%s%d ', color("ansi$fg"), $fg);
+        }
+        print_checked(color('reset'), "\n");
+    }
+    print_checked("\n");
+    return;
+}
+
+# Main routine.  Scan @ARGV for which test files to print out.
+my %tests = (
+    basic   => \&print_basic_test,
+    bright  => \&print_bright_test,
+    fg256   => \&print_fg256_test,
+    bg256   => \&print_bg256_test,
+    grey    => \&print_grey_test,
+    ansi256 => \&print_ansi256_test,
+);
+for my $file (@ARGV) {
+    if ($tests{$file}) {
+        $tests{$file}->();
+    } else {
+        die "Unknown test file: $file\n";
+    }
+}
+
+__END__
+
+=for stopwords
+fg256 bg256 RGB rgb000 rgb222 rgb555 ansi256 CPAN Starsinic Allbery grey
+grey-scale
+
+=head1 NAME
+
+generate-colors - Generate color test patterns for ANSI terminal support
+
+=head1 SYNOPSIS
+
+B<generate-colors> I<type> [I<type> ...]
+
+=head1 REQUIREMENTS
+
+Perl 5.6 and Term::ANSIColor 4.00 or later.
+
+=head1 DESCRIPTION
+
+B<generate-colors> generates test and demonstration tables for ANSI color
+and text attribute support for eight-color, sixteen-color, and 256-color
+terminal emulators.  The I<type> command-line argument specifies a table
+to print to standard output.  Multiple I<type> arguments can be specified,
+and each of those tables will be printed in the order given.
+
+The supported values of I<type> are:
+
+=over 8
+
+=item basic
+
+The basic eight ANSI colors as both foreground and background, as well as
+examples of bold for each color and a separate table of the non-color text
+attributes supported by Term::ANSIColor.
+
+=item bright
+
+The "bright" ANSI colors from the sixteen-color palette (colors 8 through
+15) on all possible color backgrounds (colors 0 through 15).
+
+=item fg256
+
+All of the 216 colors in the 256-color palette that are specified by three
+RGB values (each from 0 to 5) as foreground colors, shown against three
+possible backgrounds (rgb000, rgb222, and rgb555).
+
+=item bg256
+
+The same as C<fg256> except showing all of the background colors for three
+different possible foreground colors (rgb000, rgb222, and rgb555).
+
+=item grey
+
+The 24 grey-scale colors in the 256-color palette, shown as both foreground
+and background.
+
+=item ansi256
+
+The 256-color palette devotes the lowest 16 colors to duplicating the colors
+from the sixteen-color palette.  This test table shows all sixteen as both
+foreground and background colors, but using the 256-color escape sequence
+format to specify them.  It's possible that this test will not work with
+some emulators that support C<basic> and C<bright> if 256-color support is
+not implemented.
+
+=back
+
+=head1 SEE ALSO
+
+L<Term::ANSIColor>
+
+This script is an example in the Term::ANSIColor distribution, available
+from its web site at L<http://www.eyrie.org/~eagle/software/ansicolor/> or
+from CPAN.
+
+=head1 AUTHORS
+
+Original script written by Kurt Starsinic.  It was restructured and updated
+by Russ Allbery to add the C<basic> and C<bright> test tables.
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2012 Russ Allbery <rra@cpan.org>.  Copyright 2012 Kurt Starsinic
+<kstarsinic@gmail.com>.  This program is free software; you may
+redistribute it and/or modify it under the same terms as Perl itself.
+
+=cut
@@ -0,0 +1,1222 @@
+# Term::ANSIColor -- Color screen output using ANSI escape sequences.
+#
+# Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2005, 2006, 2008, 2009, 2010,
+#     2011, 2012, 2013, 2014 Russ Allbery <rra@cpan.org>
+# Copyright 1996 Zenin
+# Copyright 2012 Kurt Starsinic <kstarsinic@gmail.com>
+#
+# This program is free software; you may redistribute it and/or modify it
+# under the same terms as Perl itself.
+#
+# PUSH/POP support submitted 2007 by openmethods.com voice solutions
+#
+# Ah, September, when the sysadmins turn colors and fall off the trees....
+#                               -- Dave Van Domelen
+
+##############################################################################
+# Modules and declarations
+##############################################################################
+
+package Term::ANSIColor;
+
+use 5.006;
+use strict;
+use warnings;
+
+use Carp qw(croak);
+use Exporter ();
+
+# use Exporter plus @ISA instead of use base for 5.6 compatibility.
+## no critic (ClassHierarchies::ProhibitExplicitISA)
+
+# Declare variables that should be set in BEGIN for robustness.
+## no critic (Modules::ProhibitAutomaticExportation)
+our (@EXPORT, @EXPORT_OK, %EXPORT_TAGS, @ISA, $VERSION);
+
+# We use autoloading, which sets this variable to the name of the called sub.
+our $AUTOLOAD;
+
+# Set $VERSION and everything export-related in a BEGIN block for robustness
+# against circular module loading (not that we load any modules, but
+# consistency is good).
+BEGIN {
+    $VERSION = '4.03';
+
+    # All of the basic supported constants, used in %EXPORT_TAGS.
+    my @colorlist = qw(
+      CLEAR           RESET             BOLD            DARK
+      FAINT           ITALIC            UNDERLINE       UNDERSCORE
+      BLINK           REVERSE           CONCEALED
+
+      BLACK           RED               GREEN           YELLOW
+      BLUE            MAGENTA           CYAN            WHITE
+      ON_BLACK        ON_RED            ON_GREEN        ON_YELLOW
+      ON_BLUE         ON_MAGENTA        ON_CYAN         ON_WHITE
+
+      BRIGHT_BLACK    BRIGHT_RED        BRIGHT_GREEN    BRIGHT_YELLOW
+      BRIGHT_BLUE     BRIGHT_MAGENTA    BRIGHT_CYAN     BRIGHT_WHITE
+      ON_BRIGHT_BLACK ON_BRIGHT_RED     ON_BRIGHT_GREEN ON_BRIGHT_YELLOW
+      ON_BRIGHT_BLUE  ON_BRIGHT_MAGENTA ON_BRIGHT_CYAN  ON_BRIGHT_WHITE
+    );
+
+    # 256-color constants, used in %EXPORT_TAGS.
+    my @colorlist256 = (
+        (map { ("ANSI$_", "ON_ANSI$_") } 0 .. 15),
+        (map { ("GREY$_", "ON_GREY$_") } 0 .. 23),
+    );
+    for my $r (0 .. 5) {
+        for my $g (0 .. 5) {
+            push(@colorlist256, map { ("RGB$r$g$_", "ON_RGB$r$g$_") } 0 .. 5);
+        }
+    }
+
+    # Exported symbol configuration.
+    @ISA         = qw(Exporter);
+    @EXPORT      = qw(color colored);
+    @EXPORT_OK   = qw(uncolor colorstrip colorvalid coloralias);
+    %EXPORT_TAGS = (
+        constants    => \@colorlist,
+        constants256 => \@colorlist256,
+        pushpop      => [@colorlist, qw(PUSHCOLOR POPCOLOR LOCALCOLOR)],
+    );
+    Exporter::export_ok_tags('pushpop', 'constants256');
+}
+
+##############################################################################
+# Package variables
+##############################################################################
+
+# If this is set, any color changes will implicitly push the current color
+# onto the stack and then pop it at the end of the constant sequence, just as
+# if LOCALCOLOR were used.
+our $AUTOLOCAL;
+
+# Caller sets this to force a reset at the end of each constant sequence.
+our $AUTORESET;
+
+# Caller sets this to force colors to be reset at the end of each line.
+our $EACHLINE;
+
+##############################################################################
+# Internal data structures
+##############################################################################
+
+# This module does quite a bit of initialization at the time it is first
+# loaded, primarily to set up the package-global %ATTRIBUTES hash.  The
+# entries for 256-color names are easier to handle programmatically, and
+# custom colors are also imported from the environment if any are set.
+
+# All basic supported attributes, including aliases.
+#<<<
+our %ATTRIBUTES = (
+    'clear'          => 0,
+    'reset'          => 0,
+    'bold'           => 1,
+    'dark'           => 2,
+    'faint'          => 2,
+    'italic'         => 3,
+    'underline'      => 4,
+    'underscore'     => 4,
+    'blink'          => 5,
+    'reverse'        => 7,
+    'concealed'      => 8,
+
+    'black'          => 30,   'on_black'          => 40,
+    'red'            => 31,   'on_red'            => 41,
+    'green'          => 32,   'on_green'          => 42,
+    'yellow'         => 33,   'on_yellow'         => 43,
+    'blue'           => 34,   'on_blue'           => 44,
+    'magenta'        => 35,   'on_magenta'        => 45,
+    'cyan'           => 36,   'on_cyan'           => 46,
+    'white'          => 37,   'on_white'          => 47,
+
+    'bright_black'   => 90,   'on_bright_black'   => 100,
+    'bright_red'     => 91,   'on_bright_red'     => 101,
+    'bright_green'   => 92,   'on_bright_green'   => 102,
+    'bright_yellow'  => 93,   'on_bright_yellow'  => 103,
+    'bright_blue'    => 94,   'on_bright_blue'    => 104,
+    'bright_magenta' => 95,   'on_bright_magenta' => 105,
+    'bright_cyan'    => 96,   'on_bright_cyan'    => 106,
+    'bright_white'   => 97,   'on_bright_white'   => 107,
+);
+#>>>
+
+# Generating the 256-color codes involves a lot of codes and offsets that are
+# not helped by turning them into constants.
+
+# The first 16 256-color codes are duplicates of the 16 ANSI colors,
+# included for completeness.
+for my $code (0 .. 15) {
+    $ATTRIBUTES{"ansi$code"}    = "38;5;$code";
+    $ATTRIBUTES{"on_ansi$code"} = "48;5;$code";
+}
+
+# 256-color RGB colors.  Red, green, and blue can each be values 0 through 5,
+# and the resulting 216 colors start with color 16.
+for my $r (0 .. 5) {
+    for my $g (0 .. 5) {
+        for my $b (0 .. 5) {
+            my $code = 16 + (6 * 6 * $r) + (6 * $g) + $b;
+            $ATTRIBUTES{"rgb$r$g$b"}    = "38;5;$code";
+            $ATTRIBUTES{"on_rgb$r$g$b"} = "48;5;$code";
+        }
+    }
+}
+
+# The last 256-color codes are 24 shades of grey.
+for my $n (0 .. 23) {
+    my $code = $n + 232;
+    $ATTRIBUTES{"grey$n"}    = "38;5;$code";
+    $ATTRIBUTES{"on_grey$n"} = "48;5;$code";
+}
+
+# Reverse lookup.  Alphabetically first name for a sequence is preferred.
+our %ATTRIBUTES_R;
+for my $attr (reverse sort keys %ATTRIBUTES) {
+    $ATTRIBUTES_R{ $ATTRIBUTES{$attr} } = $attr;
+}
+
+# Import any custom colors set in the environment.
+our %ALIASES;
+if (exists $ENV{ANSI_COLORS_ALIASES}) {
+    my $spec = $ENV{ANSI_COLORS_ALIASES};
+    $spec =~ s{\s+}{}xmsg;
+
+    # Error reporting here is an interesting question.  Use warn rather than
+    # carp because carp would report the line of the use or require, which
+    # doesn't help anyone understand what's going on, whereas seeing this code
+    # will be more helpful.
+    ## no critic (ErrorHandling::RequireCarping)
+    for my $definition (split m{,}xms, $spec) {
+        my ($new, $old) = split m{=}xms, $definition, 2;
+        if (!$new || !$old) {
+            warn qq{Bad color mapping "$definition"};
+        } else {
+            my $result = eval { coloralias($new, $old) };
+            if (!$result) {
+                my $error = $@;
+                $error =~ s{ [ ] at [ ] .* }{}xms;
+                warn qq{$error in "$definition"};
+            }
+        }
+    }
+}
+
+# Stores the current color stack maintained by PUSHCOLOR and POPCOLOR.  This
+# is global and therefore not threadsafe.
+our @COLORSTACK;
+
+##############################################################################
+# Implementation (constant form)
+##############################################################################
+
+# Time to have fun!  We now want to define the constant subs, which are named
+# the same as the attributes above but in all caps.  Each constant sub needs
+# to act differently depending on whether $AUTORESET is set.  Without
+# autoreset:
+#
+#     BLUE "text\n"  ==>  "\e[34mtext\n"
+#
+# If $AUTORESET is set, we should instead get:
+#
+#     BLUE "text\n"  ==>  "\e[34mtext\n\e[0m"
+#
+# The sub also needs to handle the case where it has no arguments correctly.
+# Maintaining all of this as separate subs would be a major nightmare, as well
+# as duplicate the %ATTRIBUTES hash, so instead we define an AUTOLOAD sub to
+# define the constant subs on demand.  To do that, we check the name of the
+# called sub against the list of attributes, and if it's an all-caps version
+# of one of them, we define the sub on the fly and then run it.
+#
+# If the environment variable ANSI_COLORS_DISABLED is set to a true value,
+# just return the arguments without adding any escape sequences.  This is to
+# make it easier to write scripts that also work on systems without any ANSI
+# support, like Windows consoles.
+#
+## no critic (ClassHierarchies::ProhibitAutoloading)
+## no critic (Subroutines::RequireArgUnpacking)
+sub AUTOLOAD {
+    my ($sub, $attr) = $AUTOLOAD =~ m{ \A ([\w:]*::([[:upper:]\d_]+)) \z }xms;
+
+    # Check if we were called with something that doesn't look like an
+    # attribute.
+    if (!($attr && defined($ATTRIBUTES{ lc $attr }))) {
+        croak("undefined subroutine &$AUTOLOAD called");
+    }
+
+    # If colors are disabled, just return the input.  Do this without
+    # installing a sub for (marginal, unbenchmarked) speed.
+    if ($ENV{ANSI_COLORS_DISABLED}) {
+        return join(q{}, @_);
+    }
+
+    # We've untainted the name of the sub.
+    $AUTOLOAD = $sub;
+
+    # Figure out the ANSI string to set the desired attribute.
+    my $escape = "\e[" . $ATTRIBUTES{ lc $attr } . 'm';
+
+    # Save the current value of $@.  We can't just use local since we want to
+    # restore it before dispatching to the newly-created sub.  (The caller may
+    # be colorizing output that includes $@.)
+    my $eval_err = $@;
+
+    # Generate the constant sub, which should still recognize some of our
+    # package variables.  Use string eval to avoid a dependency on
+    # Sub::Install, even though it makes it somewhat less readable.
+    ## no critic (BuiltinFunctions::ProhibitStringyEval)
+    ## no critic (ValuesAndExpressions::ProhibitImplicitNewlines)
+    my $eval_result = eval qq{
+        sub $AUTOLOAD {
+            if (\$ENV{ANSI_COLORS_DISABLED}) {
+                return join(q{}, \@_);
+            } elsif (\$AUTOLOCAL && \@_) {
+                return PUSHCOLOR('$escape') . join(q{}, \@_) . POPCOLOR;
+            } elsif (\$AUTORESET && \@_) {
+                return '$escape' . join(q{}, \@_) . "\e[0m";
+            } else {
+                return '$escape' . join(q{}, \@_);
+            }
+        }
+        1;
+    };
+
+    # Failure is an internal error, not a problem with the caller.
+    ## no critic (ErrorHandling::RequireCarping)
+    if (!$eval_result) {
+        die "failed to generate constant $attr: $@";
+    }
+
+    # Restore $@.
+    ## no critic (Variables::RequireLocalizedPunctuationVars)
+    $@ = $eval_err;
+
+    # Dispatch to the newly-created sub.
+    ## no critic (References::ProhibitDoubleSigils)
+    goto &$AUTOLOAD;
+}
+## use critic (Subroutines::RequireArgUnpacking)
+
+# Append a new color to the top of the color stack and return the top of
+# the stack.
+#
+# $text - Any text we're applying colors to, with color escapes prepended
+#
+# Returns: The text passed in
+sub PUSHCOLOR {
+    my (@text) = @_;
+    my $text = join(q{}, @text);
+
+    # Extract any number of color-setting escape sequences from the start of
+    # the string.
+    my ($color) = $text =~ m{ \A ( (?:\e\[ [\d;]+ m)+ ) }xms;
+
+    # If we already have a stack, append these escapes to the set from the top
+    # of the stack.  This way, each position in the stack stores the complete
+    # enabled colors for that stage, at the cost of some potential
+    # inefficiency.
+    if (@COLORSTACK) {
+        $color = $COLORSTACK[-1] . $color;
+    }
+
+    # Push the color onto the stack.
+    push(@COLORSTACK, $color);
+    return $text;
+}
+
+# Pop the color stack and return the new top of the stack (or reset, if
+# the stack is empty).
+#
+# @text - Any text we're applying colors to
+#
+# Returns: The concatenation of @text prepended with the new stack color
+sub POPCOLOR {
+    my (@text) = @_;
+    pop(@COLORSTACK);
+    if (@COLORSTACK) {
+        return $COLORSTACK[-1] . join(q{}, @text);
+    } else {
+        return RESET(@text);
+    }
+}
+
+# Surround arguments with a push and a pop.  The effect will be to reset the
+# colors to whatever was on the color stack before this sequence of colors was
+# applied.
+#
+# @text - Any text we're applying colors to
+#
+# Returns: The concatenation of the text and the proper color reset sequence.
+sub LOCALCOLOR {
+    my (@text) = @_;
+    return PUSHCOLOR(join(q{}, @text)) . POPCOLOR();
+}
+
+##############################################################################
+# Implementation (attribute string form)
+##############################################################################
+
+# Return the escape code for a given set of color attributes.
+#
+# @codes - A list of possibly space-separated color attributes
+#
+# Returns: The escape sequence setting those color attributes
+#          undef if no escape sequences were given
+#  Throws: Text exception for any invalid attribute
+sub color {
+    my (@codes) = @_;
+    @codes = map { split } @codes;
+
+    # Return the empty string if colors are disabled.
+    if ($ENV{ANSI_COLORS_DISABLED}) {
+        return q{};
+    }
+
+    # Build the attribute string from semicolon-separated numbers.
+    my $attribute = q{};
+    for my $code (@codes) {
+        $code = lc($code);
+        if (defined($ATTRIBUTES{$code})) {
+            $attribute .= $ATTRIBUTES{$code} . q{;};
+        } elsif (defined($ALIASES{$code})) {
+            $attribute .= $ALIASES{$code} . q{;};
+        } else {
+            croak("Invalid attribute name $code");
+        }
+    }
+
+    # We added one too many semicolons for simplicity.  Remove the last one.
+    chop($attribute);
+
+    # Return undef if there were no attributes.
+    return ($attribute ne q{}) ? "\e[${attribute}m" : undef;
+}
+
+# Return a list of named color attributes for a given set of escape codes.
+# Escape sequences can be given with or without enclosing "\e[" and "m".  The
+# empty escape sequence '' or "\e[m" gives an empty list of attrs.
+#
+# There is one special case.  256-color codes start with 38 or 48, followed by
+# a 5 and then the 256-color code.
+#
+# @escapes - A list of escape sequences or escape sequence numbers
+#
+# Returns: An array of attribute names corresponding to those sequences
+#  Throws: Text exceptions on invalid escape sequences or unknown colors
+sub uncolor {
+    my (@escapes) = @_;
+    my (@nums, @result);
+
+    # Walk the list of escapes and build a list of attribute numbers.
+    for my $escape (@escapes) {
+        $escape =~ s{ \A \e\[ }{}xms;
+        $escape =~ s{ m \z }   {}xms;
+        my ($attrs) = $escape =~ m{ \A ((?:\d+;)* \d*) \z }xms;
+        if (!defined($attrs)) {
+            croak("Bad escape sequence $escape");
+        }
+
+        # Pull off 256-color codes (38;5;n or 48;5;n) as a unit.
+        push(@nums, $attrs =~ m{ ( 0*[34]8;0*5;\d+ | \d+ ) (?: ; | \z ) }xmsg);
+    }
+
+    # Now, walk the list of numbers and convert them to attribute names.
+    # Strip leading zeroes from any of the numbers.  (xterm, at least, allows
+    # leading zeroes to be added to any number in an escape sequence.)
+    for my $num (@nums) {
+        $num =~ s{ ( \A | ; ) 0+ (\d) }{$1$2}xmsg;
+        my $name = $ATTRIBUTES_R{$num};
+        if (!defined($name)) {
+            croak("No name for escape sequence $num");
+        }
+        push(@result, $name);
+    }
+
+    # Return the attribute names.
+    return @result;
+}
+
+# Given a string and a set of attributes, returns the string surrounded by
+# escape codes to set those attributes and then clear them at the end of the
+# string.  The attributes can be given either as an array ref as the first
+# argument or as a list as the second and subsequent arguments.
+#
+# If $EACHLINE is set, insert a reset before each occurrence of the string
+# $EACHLINE and the starting attribute code after the string $EACHLINE, so
+# that no attribute crosses line delimiters (this is often desirable if the
+# output is to be piped to a pager or some other program).
+#
+# $first - An anonymous array of attributes or the text to color
+# @rest  - The text to color or the list of attributes
+#
+# Returns: The text, concatenated if necessary, surrounded by escapes to set
+#          the desired colors and reset them afterwards
+#  Throws: Text exception on invalid attributes
+sub colored {
+    my ($first, @rest) = @_;
+    my ($string, @codes);
+    if (ref($first) && ref($first) eq 'ARRAY') {
+        @codes = @{$first};
+        $string = join(q{}, @rest);
+    } else {
+        $string = $first;
+        @codes  = @rest;
+    }
+
+    # Return the string unmolested if colors are disabled.
+    if ($ENV{ANSI_COLORS_DISABLED}) {
+        return $string;
+    }
+
+    # Find the attribute string for our colors.
+    my $attr = color(@codes);
+
+    # If $EACHLINE is defined, split the string on line boundaries, suppress
+    # empty segments, and then colorize each of the line sections.
+    if (defined($EACHLINE)) {
+        my @text = map { ($_ ne $EACHLINE) ? $attr . $_ . "\e[0m" : $_ }
+          grep { length($_) > 0 }
+          split(m{ (\Q$EACHLINE\E) }xms, $string);
+        return join(q{}, @text);
+    } else {
+        return $attr . $string . "\e[0m";
+    }
+}
+
+# Define a new color alias, or return the value of an existing alias.
+#
+# $alias - The color alias to define
+# $color - The standard color the alias will correspond to (optional)
+#
+# Returns: The standard color value of the alias
+#          undef if one argument was given and the alias was not recognized
+#  Throws: Text exceptions for invalid alias names, attempts to use a
+#          standard color name as an alias, or an unknown standard color name
+sub coloralias {
+    my ($alias, $color) = @_;
+    if (!defined($color)) {
+        if (!exists $ALIASES{$alias}) {
+            return;
+        } else {
+            return $ATTRIBUTES_R{ $ALIASES{$alias} };
+        }
+    }
+    if ($alias !~ m{ \A [\w._-]+ \z }xms) {
+        croak(qq{Invalid alias name "$alias"});
+    } elsif ($ATTRIBUTES{$alias}) {
+        croak(qq{Cannot alias standard color "$alias"});
+    } elsif (!exists $ATTRIBUTES{$color}) {
+        croak(qq{Invalid attribute name "$color"});
+    }
+    $ALIASES{$alias} = $ATTRIBUTES{$color};
+    return $color;
+}
+
+# Given a string, strip the ANSI color codes out of that string and return the
+# result.  This removes only ANSI color codes, not movement codes and other
+# escape sequences.
+#
+# @string - The list of strings to sanitize
+#
+# Returns: (array)  The strings stripped of ANSI color escape sequences
+#          (scalar) The same, concatenated
+sub colorstrip {
+    my (@string) = @_;
+    for my $string (@string) {
+        $string =~ s{ \e\[ [\d;]* m }{}xmsg;
+    }
+    return wantarray ? @string : join(q{}, @string);
+}
+
+# Given a list of color attributes (arguments for color, for instance), return
+# true if they're all valid or false if any of them are invalid.
+#
+# @codes - A list of color attributes, possibly space-separated
+#
+# Returns: True if all the attributes are valid, false otherwise.
+sub colorvalid {
+    my (@codes) = @_;
+    @codes = map { split(q{ }, lc($_)) } @codes;
+    for my $code (@codes) {
+        if (!defined($ATTRIBUTES{$code}) && !defined($ALIASES{$code})) {
+            return;
+        }
+    }
+    return 1;
+}
+
+##############################################################################
+# Module return value and documentation
+##############################################################################
+
+# Ensure we evaluate to true.
+1;
+__END__
+
+=head1 NAME
+
+Term::ANSIColor - Color screen output using ANSI escape sequences
+
+=for stopwords
+cyan colorize namespace runtime TMTOWTDI cmd.exe cmd.exe. 4nt.exe. 4nt.exe
+command.com NT ESC Delvare SSH OpenSSH aixterm ECMA-048 Fraktur overlining
+Zenin reimplemented Allbery PUSHCOLOR POPCOLOR LOCALCOLOR openmethods.com
+openmethods.com. grey ATTR urxvt mistyped prepending Bareword filehandle
+Cygwin Starsinic aterm rxvt CPAN RGB Solarized Whitespace alphanumerics
+undef
+
+=head1 SYNOPSIS
+
+    use Term::ANSIColor;
+    print color('bold blue');
+    print "This text is bold blue.\n";
+    print color('reset');
+    print "This text is normal.\n";
+    print colored("Yellow on magenta.", 'yellow on_magenta'), "\n";
+    print "This text is normal.\n";
+    print colored(['yellow on_magenta'], 'Yellow on magenta.', "\n");
+    print colored(['red on_bright_yellow'], 'Red on bright yellow.', "\n");
+    print colored(['bright_red on_black'], 'Bright red on black.', "\n");
+    print "\n";
+
+    # Map escape sequences back to color names.
+    use Term::ANSIColor 1.04 qw(uncolor);
+    my $names = uncolor('01;31');
+    print join(q{ }, @{$names}), "\n";
+
+    # Strip all color escape sequences.
+    use Term::ANSIColor 2.01 qw(colorstrip);
+    print colorstrip("\e[1mThis is bold\e[0m"), "\n";
+
+    # Determine whether a color is valid.
+    use Term::ANSIColor 2.02 qw(colorvalid);
+    my $valid = colorvalid('blue bold', 'on_magenta');
+    print "Color string is ", $valid ? "valid\n" : "invalid\n";
+
+    # Create new aliases for colors.
+    use Term::ANSIColor 4.00 qw(coloralias);
+    coloralias('alert', 'red');
+    print "Alert is ", coloralias('alert'), "\n";
+    print colored("This is in red.", 'alert'), "\n";
+
+    use Term::ANSIColor qw(:constants);
+    print BOLD, BLUE, "This text is in bold blue.\n", RESET;
+
+    use Term::ANSIColor qw(:constants);
+    {
+        local $Term::ANSIColor::AUTORESET = 1;
+        print BOLD BLUE "This text is in bold blue.\n";
+        print "This text is normal.\n";
+    }
+
+    use Term::ANSIColor 2.00 qw(:pushpop);
+    print PUSHCOLOR RED ON_GREEN "This text is red on green.\n";
+    print PUSHCOLOR BRIGHT_BLUE "This text is bright blue on green.\n";
+    print RESET BRIGHT_BLUE "This text is just bright blue.\n";
+    print POPCOLOR "Back to red on green.\n";
+    print LOCALCOLOR GREEN ON_BLUE "This text is green on blue.\n";
+    print "This text is red on green.\n";
+    {
+        local $Term::ANSIColor::AUTOLOCAL = 1;
+        print ON_BLUE "This text is red on blue.\n";
+        print "This text is red on green.\n";
+    }
+    print POPCOLOR "Back to whatever we started as.\n";
+
+=head1 DESCRIPTION
+
+This module has two interfaces, one through color() and colored() and the
+other through constants.  It also offers the utility functions uncolor(),
+colorstrip(), colorvalid(), and coloralias(), which have to be explicitly
+imported to be used (see L</SYNOPSIS>).
+
+See L</COMPATIBILITY> for the versions of Term::ANSIColor that introduced
+particular features and the versions of Perl that included them.
+
+=head2 Supported Colors
+
+Terminal emulators that support color divide into two types: ones that
+support only eight colors, ones that support sixteen, and ones that
+support 256.  This module provides the ANSI escape codes all of them.
+These colors are referred to as ANSI colors 0 through 7 (normal), 8
+through 15 (16-color), and 16 through 255 (256-color).
+
+Unfortunately, interpretation of colors 0 through 7 often depends on
+whether the emulator supports eight colors or sixteen colors.  Emulators
+that only support eight colors (such as the Linux console) will display
+colors 0 through 7 with normal brightness and ignore colors 8 through 15,
+treating them the same as white.  Emulators that support 16 colors, such
+as gnome-terminal, normally display colors 0 through 7 as dim or darker
+versions and colors 8 through 15 as normal brightness.  On such emulators,
+the "normal" white (color 7) usually is shown as pale grey, requiring
+bright white (15) to be used to get a real white color.  Bright black
+usually is a dark grey color, although some terminals display it as pure
+black.  Some sixteen-color terminal emulators also treat normal yellow
+(color 3) as orange or brown, and bright yellow (color 11) as yellow.
+
+Following the normal convention of sixteen-color emulators, this module
+provides a pair of attributes for each color.  For every normal color (0
+through 7), the corresponding bright color (8 through 15) is obtained by
+prepending the string C<bright_> to the normal color name.  For example,
+C<red> is color 1 and C<bright_red> is color 9.  The same applies for
+background colors: C<on_red> is the normal color and C<on_bright_red> is
+the bright color.  Capitalize these strings for the constant interface.
+
+For 256-color emulators, this module additionally provides C<ansi0>
+through C<ansi15>, which are the same as colors 0 through 15 in
+sixteen-color emulators but use the 256-color escape syntax, C<grey0>
+through C<grey23> ranging from nearly black to nearly white, and a set of
+RGB colors.  The RGB colors are of the form C<rgbI<RGB>> where I<R>, I<G>,
+and I<B> are numbers from 0 to 5 giving the intensity of red, green, and
+blue.  C<on_> variants of all of these colors are also provided.  These
+colors may be ignored completely on non-256-color terminals or may be
+misinterpreted and produce random behavior.  Additional attributes such as
+blink, italic, or bold may not work with the 256-color palette.
+
+There is unfortunately no way to know whether the current emulator
+supports more than eight colors, which makes the choice of colors
+difficult.  The most conservative choice is to use only the regular
+colors, which are at least displayed on all emulators.  However, they will
+appear dark in sixteen-color terminal emulators, including most common
+emulators in UNIX X environments.  If you know the display is one of those
+emulators, you may wish to use the bright variants instead.  Even better,
+offer the user a way to configure the colors for a given application to
+fit their terminal emulator.
+
+=head2 Function Interface
+
+The function interface uses attribute strings to describe the colors and
+text attributes to assign to text.  The recognized non-color attributes
+are clear, reset, bold, dark, faint, italic, underline, underscore, blink,
+reverse, and concealed.  Clear and reset (reset to default attributes),
+dark and faint (dim and saturated), and underline and underscore are
+equivalent, so use whichever is the most intuitive to you.
+
+Note that not all attributes are supported by all terminal types, and some
+terminals may not support any of these sequences.  Dark and faint, italic,
+blink, and concealed in particular are frequently not implemented.
+
+The recognized normal foreground color attributes (colors 0 to 7) are:
+
+  black  red  green  yellow  blue  magenta  cyan  white
+
+The corresponding bright foreground color attributes (colors 8 to 15) are:
+
+  bright_black  bright_red      bright_green  bright_yellow
+  bright_blue   bright_magenta  bright_cyan   bright_white
+
+The recognized normal background color attributes (colors 0 to 7) are:
+
+  on_black  on_red      on_green  on yellow
+  on_blue   on_magenta  on_cyan   on_white
+
+The recognized bright background color attributes (colors 8 to 15) are:
+
+  on_bright_black  on_bright_red      on_bright_green  on_bright_yellow
+  on_bright_blue   on_bright_magenta  on_bright_cyan   on_bright_white
+
+For 256-color terminals, the recognized foreground colors are:
+
+  ansi0 .. ansi15
+  grey0 .. grey23
+
+plus C<rgbI<RGB>> for I<R>, I<G>, and I<B> values from 0 to 5, such as
+C<rgb000> or C<rgb515>.  Similarly, the recognized background colors are:
+
+  on_ansi0 .. on_ansi15
+  on_grey0 .. on_grey23
+
+plus C<on_rgbI<RGB>> for I<R>, I<G>, and I<B> values from 0 to 5.
+
+For any of the above listed attributes, case is not significant.
+
+Attributes, once set, last until they are unset (by printing the attribute
+C<clear> or C<reset>).  Be careful to do this, or otherwise your attribute
+will last after your script is done running, and people get very annoyed
+at having their prompt and typing changed to weird colors.
+
+=over 4
+
+=item color(ATTR[, ATTR ...])
+
+color() takes any number of strings as arguments and considers them to be
+space-separated lists of attributes.  It then forms and returns the escape
+sequence to set those attributes.  It doesn't print it out, just returns
+it, so you'll have to print it yourself if you want to.  This is so that
+you can save it as a string, pass it to something else, send it to a file
+handle, or do anything else with it that you might care to.  color()
+throws an exception if given an invalid attribute.
+
+=item colored(STRING, ATTR[, ATTR ...])
+
+=item colored(ATTR-REF, STRING[, STRING...])
+
+As an aid in resetting colors, colored() takes a scalar as the first
+argument and any number of attribute strings as the second argument and
+returns the scalar wrapped in escape codes so that the attributes will be
+set as requested before the string and reset to normal after the string.
+Alternately, you can pass a reference to an array as the first argument,
+and then the contents of that array will be taken as attributes and color
+codes and the remainder of the arguments as text to colorize.
+
+Normally, colored() just puts attribute codes at the beginning and end of
+the string, but if you set $Term::ANSIColor::EACHLINE to some string, that
+string will be considered the line delimiter and the attribute will be set
+at the beginning of each line of the passed string and reset at the end of
+each line.  This is often desirable if the output contains newlines and
+you're using background colors, since a background color that persists
+across a newline is often interpreted by the terminal as providing the
+default background color for the next line.  Programs like pagers can also
+be confused by attributes that span lines.  Normally you'll want to set
+$Term::ANSIColor::EACHLINE to C<"\n"> to use this feature.
+
+=item uncolor(ESCAPE)
+
+uncolor() performs the opposite translation as color(), turning escape
+sequences into a list of strings corresponding to the attributes being set
+by those sequences.
+
+=item colorstrip(STRING[, STRING ...])
+
+colorstrip() removes all color escape sequences from the provided strings,
+returning the modified strings separately in array context or joined
+together in scalar context.  Its arguments are not modified.
+
+=item colorvalid(ATTR[, ATTR ...])
+
+colorvalid() takes attribute strings the same as color() and returns true
+if all attributes are known and false otherwise.
+
+=item coloralias(ALIAS[, ATTR])
+
+If ATTR is specified, coloralias() sets up an alias of ALIAS for the
+standard color ATTR.  From that point forward, ALIAS can be passed into
+color(), colored(), and colorvalid() and will have the same meaning as
+ATTR.  One possible use of this facility is to give more meaningful names
+to the 256-color RGB colors.  Only alphanumerics, C<.>, C<_>, and C<-> are
+allowed in alias names.
+
+If ATTR is not specified, coloralias() returns the standard color name to
+which ALIAS is aliased, if any, or undef if ALIAS does not exist.
+
+This is the same facility used by the ANSI_COLORS_ALIASES environment
+variable (see L</ENVIRONMENT> below) but can be used at runtime, not just
+when the module is loaded.
+
+Later invocations of coloralias() with the same ALIAS will override
+earlier aliases.  There is no way to remove an alias.
+
+Aliases have no effect on the return value of uncolor().
+
+B<WARNING>: Aliases are global and affect all callers in the same process.
+There is no way to set an alias limited to a particular block of code or a
+particular object.
+
+=back
+
+=head2 Constant Interface
+
+Alternately, if you import C<:constants>, you can use the following
+constants directly:
+
+  CLEAR           RESET             BOLD            DARK
+  FAINT           ITALIC            UNDERLINE       UNDERSCORE
+  BLINK           REVERSE           CONCEALED
+
+  BLACK           RED               GREEN           YELLOW
+  BLUE            MAGENTA           CYAN            WHITE
+  BRIGHT_BLACK    BRIGHT_RED        BRIGHT_GREEN    BRIGHT_YELLOW
+  BRIGHT_BLUE     BRIGHT_MAGENTA    BRIGHT_CYAN     BRIGHT_WHITE
+
+  ON_BLACK        ON_RED            ON_GREEN        ON_YELLOW
+  ON_BLUE         ON_MAGENTA        ON_CYAN         ON_WHITE
+  ON_BRIGHT_BLACK ON_BRIGHT_RED     ON_BRIGHT_GREEN ON_BRIGHT_YELLOW
+  ON_BRIGHT_BLUE  ON_BRIGHT_MAGENTA ON_BRIGHT_CYAN  ON_BRIGHT_WHITE
+
+These are the same as color('attribute') and can be used if you prefer
+typing:
+
+    print BOLD BLUE ON_WHITE "Text", RESET, "\n";
+
+to
+
+    print colored ("Text", 'bold blue on_white'), "\n";
+
+(Note that the newline is kept separate to avoid confusing the terminal as
+described above since a background color is being used.)
+
+If you import C<:constants256>, you can use the following constants
+directly:
+
+  ANSI0 .. ANSI15
+  GREY0 .. GREY23
+
+  RGBXYZ (for X, Y, and Z values from 0 to 5, like RGB000 or RGB515)
+
+  ON_ANSI0 .. ON_ANSI15
+  ON_GREY0 .. ON_GREY23
+
+  ON_RGBXYZ (for X, Y, and Z values from 0 to 5)
+
+Note that C<:constants256> does not include the other constants, so if you
+want to mix both, you need to include C<:constants> as well.  You may want
+to explicitly import at least C<RESET>, as in:
+
+    use Term::ANSIColor 4.00 qw(RESET :constants256);
+
+When using the constants, if you don't want to have to remember to add the
+C<, RESET> at the end of each print line, you can set
+$Term::ANSIColor::AUTORESET to a true value.  Then, the display mode will
+automatically be reset if there is no comma after the constant.  In other
+words, with that variable set:
+
+    print BOLD BLUE "Text\n";
+
+will reset the display mode afterward, whereas:
+
+    print BOLD, BLUE, "Text\n";
+
+will not.  If you are using background colors, you will probably want to
+either use say() (in newer versions of Perl) or print the newline with a
+separate print statement to avoid confusing the terminal.
+
+If $Term::ANSIColor::AUTOLOCAL is set (see below), it takes precedence
+over $Term::ANSIColor::AUTORESET, and the latter is ignored.
+
+The subroutine interface has the advantage over the constants interface in
+that only two subroutines are exported into your namespace, versus
+thirty-eight in the constants interface.  On the flip side, the constants
+interface has the advantage of better compile time error checking, since
+misspelled names of colors or attributes in calls to color() and colored()
+won't be caught until runtime whereas misspelled names of constants will
+be caught at compile time.  So, pollute your namespace with almost two
+dozen subroutines that you may not even use that often, or risk a silly
+bug by mistyping an attribute.  Your choice, TMTOWTDI after all.
+
+=head2 The Color Stack
+
+You can import C<:pushpop> and maintain a stack of colors using PUSHCOLOR,
+POPCOLOR, and LOCALCOLOR.  PUSHCOLOR takes the attribute string that
+starts its argument and pushes it onto a stack of attributes.  POPCOLOR
+removes the top of the stack and restores the previous attributes set by
+the argument of a prior PUSHCOLOR.  LOCALCOLOR surrounds its argument in a
+PUSHCOLOR and POPCOLOR so that the color resets afterward.
+
+If $Term::ANSIColor::AUTOLOCAL is set, each sequence of color constants
+will be implicitly preceded by LOCALCOLOR.  In other words, the following:
+
+    {
+        local $Term::ANSIColor::AUTOLOCAL = 1;
+        print BLUE "Text\n";
+    }
+
+is equivalent to:
+
+    print LOCALCOLOR BLUE "Text\n";
+
+If $Term::ANSIColor::AUTOLOCAL is set, it takes precedence over
+$Term::ANSIColor::AUTORESET, and the latter is ignored.
+
+When using PUSHCOLOR, POPCOLOR, and LOCALCOLOR, it's particularly
+important to not put commas between the constants.
+
+    print PUSHCOLOR BLUE "Text\n";
+
+will correctly push BLUE onto the top of the stack.
+
+    print PUSHCOLOR, BLUE, "Text\n";    # wrong!
+
+will not, and a subsequent pop won't restore the correct attributes.
+PUSHCOLOR pushes the attributes set by its argument, which is normally a
+string of color constants.  It can't ask the terminal what the current
+attributes are.
+
+=head1 DIAGNOSTICS
+
+=over 4
+
+=item Bad color mapping %s
+
+(W) The specified color mapping from ANSI_COLORS_ALIASES is not valid and
+could not be parsed.  It was ignored.
+
+=item Bad escape sequence %s
+
+(F) You passed an invalid ANSI escape sequence to uncolor().
+
+=item Bareword "%s" not allowed while "strict subs" in use
+
+(F) You probably mistyped a constant color name such as:
+
+    $Foobar = FOOBAR . "This line should be blue\n";
+
+or:
+
+    @Foobar = FOOBAR, "This line should be blue\n";
+
+This will only show up under use strict (another good reason to run under
+use strict).
+
+=item Cannot alias standard color %s
+
+(F) The alias name passed to coloralias() matches a standard color name.
+Standard color names cannot be aliased.
+
+=item Cannot alias standard color %s in %s
+
+(W) The same, but in ANSI_COLORS_ALIASES.  The color mapping was ignored.
+
+=item Invalid alias name %s
+
+(F) You passed an invalid alias name to coloralias().  Alias names must
+consist only of alphanumerics, C<.>, C<->, and C<_>.
+
+=item Invalid alias name %s in %s
+
+(W) You specified an invalid alias name on the left hand of the equal sign
+in a color mapping in ANSI_COLORS_ALIASES.  The color mapping was ignored.
+
+=item Invalid attribute name %s
+
+(F) You passed an invalid attribute name to color(), colored(), or
+coloralias().
+
+=item Invalid attribute name %s in %s
+
+(W) You specified an invalid attribute name on the right hand of the equal
+sign in a color mapping in ANSI_COLORS_ALIASES.  The color mapping was
+ignored.
+
+=item Name "%s" used only once: possible typo
+
+(W) You probably mistyped a constant color name such as:
+
+    print FOOBAR "This text is color FOOBAR\n";
+
+It's probably better to always use commas after constant names in order to
+force the next error.
+
+=item No comma allowed after filehandle
+
+(F) You probably mistyped a constant color name such as:
+
+    print FOOBAR, "This text is color FOOBAR\n";
+
+Generating this fatal compile error is one of the main advantages of using
+the constants interface, since you'll immediately know if you mistype a
+color name.
+
+=item No name for escape sequence %s
+
+(F) The ANSI escape sequence passed to uncolor() contains escapes which
+aren't recognized and can't be translated to names.
+
+=back
+
+=head1 ENVIRONMENT
+
+=over 4
+
+=item ANSI_COLORS_ALIASES
+
+This environment variable allows the user to specify custom color aliases
+that will be understood by color(), colored(), and colorvalid().  None of
+the other functions will be affected, and no new color constants will be
+created.  The custom colors are aliases for existing color names; no new
+escape sequences can be introduced.  Only alphanumerics, C<.>, C<_>, and
+C<-> are allowed in alias names.
+
+The format is:
+
+    ANSI_COLORS_ALIASES='newcolor1=oldcolor1,newcolor2=oldcolor2'
+
+Whitespace is ignored.
+
+For example the L<Solarized|http://ethanschoonover.com/solarized> colors
+can be mapped with:
+
+    ANSI_COLORS_ALIASES='\
+        base00=bright_yellow, on_base00=on_bright_yellow,\
+        base01=bright_green,  on_base01=on_bright_green, \
+        base02=black,         on_base02=on_black,        \
+        base03=bright_black,  on_base03=on_bright_black, \
+        base0=bright_blue,    on_base0=on_bright_blue,   \
+        base1=bright_cyan,    on_base1=on_bright_cyan,   \
+        base2=white,          on_base2=on_white,         \
+        base3=bright_white,   on_base3=on_bright_white,  \
+        orange=bright_red,    on_orange=on_bright_red,   \
+        violet=bright_magenta,on_violet=on_bright_magenta'
+
+This environment variable is read and applied when the Term::ANSIColor
+module is loaded and is then subsequently ignored.  Changes to
+ANSI_COLORS_ALIASES after the module is loaded will have no effect.  See
+coloralias() for an equivalent facility that can be used at runtime.
+
+=item ANSI_COLORS_DISABLED
+
+If this environment variable is set to a true value, all of the functions
+defined by this module (color(), colored(), and all of the constants not
+previously used in the program) will not output any escape sequences and
+instead will just return the empty string or pass through the original
+text as appropriate.  This is intended to support easy use of scripts
+using this module on platforms that don't support ANSI escape sequences.
+
+=back
+
+=head1 COMPATIBILITY
+
+Term::ANSIColor was first included with Perl in Perl 5.6.0.
+
+The uncolor() function and support for ANSI_COLORS_DISABLED were added in
+Term::ANSIColor 1.04, included in Perl 5.8.0.
+
+Support for dark was added in Term::ANSIColor 1.08, included in Perl
+5.8.4.
+
+The color stack, including the C<:pushpop> import tag, PUSHCOLOR,
+POPCOLOR, LOCALCOLOR, and the $Term::ANSIColor::AUTOLOCAL variable, was
+added in Term::ANSIColor 2.00, included in Perl 5.10.1.
+
+colorstrip() was added in Term::ANSIColor 2.01 and colorvalid() was added
+in Term::ANSIColor 2.02, both included in Perl 5.11.0.
+
+Support for colors 8 through 15 (the C<bright_> variants) was added in
+Term::ANSIColor 3.00, included in Perl 5.13.3.
+
+Support for italic was added in Term::ANSIColor 3.02, included in Perl
+5.17.1.
+
+Support for colors 16 through 256 (the C<ansi>, C<rgb>, and C<grey>
+colors), the C<:constants256> import tag, the coloralias() function, and
+support for the ANSI_COLORS_ALIASES environment variable were added in
+Term::ANSIColor 4.00, included in Perl 5.17.8.
+
+$Term::ANSIColor::AUTOLOCAL was changed to take precedence over
+$Term::ANSIColor::AUTORESET, rather than the other way around, in
+Term::ANSIColor 4.00, included in Perl 5.17.8.
+
+=head1 RESTRICTIONS
+
+It would be nice if one could leave off the commas around the constants
+entirely and just say:
+
+    print BOLD BLUE ON_WHITE "Text\n" RESET;
+
+but the syntax of Perl doesn't allow this.  You need a comma after the
+string.  (Of course, you may consider it a bug that commas between all the
+constants aren't required, in which case you may feel free to insert
+commas unless you're using $Term::ANSIColor::AUTORESET or
+PUSHCOLOR/POPCOLOR.)
+
+For easier debugging, you may prefer to always use the commas when not
+setting $Term::ANSIColor::AUTORESET or PUSHCOLOR/POPCOLOR so that you'll
+get a fatal compile error rather than a warning.
+
+It's not possible to use this module to embed formatting and color
+attributes using Perl formats.  They replace the escape character with a
+space (as documented in L<perlform(1)>), resulting in garbled output from
+the unrecognized attribute.  Even if there were a way around that problem,
+the format doesn't know that the non-printing escape sequence is
+zero-length and would incorrectly format the output.  For formatted output
+using color or other attributes, either use sprintf() instead or use
+formline() and then add the color or other attributes after formatting and
+before output.
+
+=head1 NOTES
+
+The codes generated by this module are standard terminal control codes,
+complying with ECMA-048 and ISO 6429 (generally referred to as "ANSI
+color" for the color codes).  The non-color control codes (bold, dark,
+italic, underline, and reverse) are part of the earlier ANSI X3.64
+standard for control sequences for video terminals and peripherals.
+
+Note that not all displays are ISO 6429-compliant, or even X3.64-compliant
+(or are even attempting to be so).  This module will not work as expected
+on displays that do not honor these escape sequences, such as cmd.exe,
+4nt.exe, and command.com under either Windows NT or Windows 2000.  They
+may just be ignored, or they may display as an ESC character followed by
+some apparent garbage.
+
+Jean Delvare provided the following table of different common terminal
+emulators and their support for the various attributes and others have
+helped me flesh it out:
+
+              clear    bold     faint   under    blink   reverse  conceal
+ ------------------------------------------------------------------------
+ xterm         yes      yes      no      yes      yes      yes      yes
+ linux         yes      yes      yes    bold      yes      yes      no
+ rxvt          yes      yes      no      yes  bold/black   yes      no
+ dtterm        yes      yes      yes     yes    reverse    yes      yes
+ teraterm      yes    reverse    no      yes    rev/red    yes      no
+ aixterm      kinda   normal     no      yes      no       yes      yes
+ PuTTY         yes     color     no      yes      no       yes      no
+ Windows       yes      no       no      no       no       yes      no
+ Cygwin SSH    yes      yes      no     color    color    color     yes
+ Terminal.app  yes      yes      no      yes      yes      yes      yes
+
+Windows is Windows telnet, Cygwin SSH is the OpenSSH implementation under
+Cygwin on Windows NT, and Mac Terminal is the Terminal application in Mac
+OS X.  Where the entry is other than yes or no, that emulator displays the
+given attribute as something else instead.  Note that on an aixterm, clear
+doesn't reset colors; you have to explicitly set the colors back to what
+you want.  More entries in this table are welcome.
+
+Support for code 3 (italic) is rare and therefore not mentioned in that
+table.  It is not believed to be fully supported by any of the terminals
+listed, although it's displayed as green in the Linux console, but it is
+reportedly supported by urxvt.
+
+Note that codes 6 (rapid blink) and 9 (strike-through) are specified in
+ANSI X3.64 and ECMA-048 but are not commonly supported by most displays
+and emulators and therefore aren't supported by this module at the present
+time.  ECMA-048 also specifies a large number of other attributes,
+including a sequence of attributes for font changes, Fraktur characters,
+double-underlining, framing, circling, and overlining.  As none of these
+attributes are widely supported or useful, they also aren't currently
+supported by this module.
+
+Most modern X terminal emulators support 256 colors.  Known to not support
+those colors are aterm, rxvt, Terminal.app, and TTY/VC.
+
+=head1 AUTHORS
+
+Original idea (using constants) by Zenin, reimplemented using subs by Russ
+Allbery <rra@cpan.org>, and then combined with the original idea by
+Russ with input from Zenin.  256-color support is based on work by Kurt
+Starsinic.  Russ Allbery now maintains this module.
+
+PUSHCOLOR, POPCOLOR, and LOCALCOLOR were contributed by openmethods.com
+voice solutions.
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 1996 Zenin.  Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2005,
+2006, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Russ Allbery
+<rra@cpan.org>.  Copyright 2012 Kurt Starsinic <kstarsinic@gmail.com>.
+This program is free software; you may redistribute it and/or modify it
+under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+The CPAN module L<Term::ExtendedColor> provides a different and more
+comprehensive interface for 256-color emulators that may be more
+convenient.  The CPAN module L<Win32::Console::ANSI> provides ANSI color
+(and other escape sequence) support in the Win32 Console environment.
+
+ECMA-048 is available on-line (at least at the time of this writing) at
+L<http://www.ecma-international.org/publications/standards/Ecma-048.htm>.
+
+ISO 6429 is available from ISO for a charge; the author of this module
+does not own a copy of it.  Since the source material for ISO 6429 was
+ECMA-048 and the latter is available for free, there seems little reason
+to obtain the ISO standard.
+
+The 256-color control sequences are documented at
+L<http://invisible-island.net/xterm/ctlseqs/ctlseqs.html> (search for
+256-color).
+
+The current version of this module is always available from its web site
+at L<http://www.eyrie.org/~eagle/software/ansicolor/>.  It is also part of
+the Perl core distribution as of 5.6.0.
+
+=cut
@@ -1,151 +0,0 @@
-#!/usr/bin/perl -Tw
-#
-# t/basic.t -- Test suite for the Term::ANSIColor Perl module.
-#
-# Copyright 1997, 1998, 2000, 2001, 2002, 2005, 2006, 2009, 2010, 2012
-#     Russ Allbery <rra@stanford.edu>
-#
-# This program is free software; you may redistribute it and/or modify it
-# under the same terms as Perl itself.
-
-use strict;
-use Test::More tests => 54;
-
-BEGIN {
-    delete $ENV{ANSI_COLORS_DISABLED};
-    use_ok ('Term::ANSIColor',
-            qw/:pushpop color colored uncolor colorstrip colorvalid/);
-}
-
-# Various basic tests.
-is (color ('blue on_green', 'bold'), "\e[34;42;1m", 'Simple attributes');
-is (colored ('testing', 'blue', 'bold'), "\e[34;1mtesting\e[0m", 'colored');
-is ((BLUE BOLD "testing"), "\e[34m\e[1mtesting", 'Constants');
-$Term::ANSIColor::AUTORESET = 1;
-is ((BLUE BOLD "testing"), "\e[34m\e[1mtesting\e[0m\e[0m", 'AUTORESET');
-$Term::ANSIColor::EACHLINE = "\n";
-is (colored ("test\n\ntest", 'bold'), "\e[1mtest\e[0m\n\n\e[1mtest\e[0m",
-    'EACHLINE');
-$Term::ANSIColor::EACHLINE = "\r\n";
-is (colored ("test\ntest\r\r\n\r\n", 'bold'),
-    "\e[1mtest\ntest\r\e[0m\r\n\r\n",
-    'EACHLINE with multiple delimiters');
-$Term::ANSIColor::EACHLINE = "\n";
-is (colored (['bold', 'on_green'], "test\n", "\n", "test"),
-    "\e[1;42mtest\e[0m\n\n\e[1;42mtest\e[0m",
-    'colored with reference to array');
-is_deeply ([ uncolor ('1;42', "\e[m", '', "\e[0m") ],
-           [ qw/bold on_green clear/ ], 'uncolor');
-
-# Several tests for ANSI_COLORS_DISABLED.
-$ENV{ANSI_COLORS_DISABLED} = 1;
-is (color ('blue'), '', 'color support for ANSI_COLORS_DISABLED');
-is (colored ('testing', 'blue', 'on_red'), 'testing',
-    'colored support for ANSI_COLORS_DISABLED');
-is ((GREEN 'testing'), 'testing', 'Constant support for ANSI_COLORS_DISABLED');
-delete $ENV{ANSI_COLORS_DISABLED};
-
-# Make sure DARK is exported.  This was omitted in versions prior to 1.07.
-is ((DARK "testing"), "\e[2mtesting\e[0m", 'DARK');
-
-# Check faint as a synonym for dark.
-is (colored ('test', 'faint'), "\e[2mtest\e[0m", 'colored supports faint');
-is ((FAINT "test"), "\e[2mtest\e[0m", '...and the FAINT constant works');
-
-# Test bright color support.
-is (color ('bright_red'), "\e[91m", 'Bright red is supported');
-is ((BRIGHT_RED "test"), "\e[91mtest\e[0m", '...and as a constant');
-is (color ('on_bright_red'), "\e[101m", '...as is on bright red');
-is ((ON_BRIGHT_RED "test"), "\e[101mtest\e[0m", '...and as a constant');
-
-# Test italic, which was added in 3.02.
-is (color ('italic'), "\e[3m", 'Italic is supported');
-is ((ITALIC 'test'), "\e[3mtest\e[0m", '...and as a constant');
-
-# Test colored with 0 and EACHLINE.
-$Term::ANSIColor::EACHLINE = "\n";
-is (colored ('0', 'blue', 'bold'), "\e[34;1m0\e[0m",
-    'colored with 0 and EACHLINE');
-is (colored ("0\n0\n\n", 'blue', 'bold'), "\e[34;1m0\e[0m\n\e[34;1m0\e[0m\n\n",
-    'colored with 0, EACHLINE, and multiple lines');
-
-# Test colored with the empty string and EACHLINE.
-is (colored ('', 'blue', 'bold'), '',
-    'colored with an empty string and EACHLINE');
-
-# Test push and pop support.
-$Term::ANSIColor::AUTORESET = 0;
-is ((PUSHCOLOR RED ON_GREEN "text"), "\e[31m\e[42mtext",
-    'PUSHCOLOR does not break constants');
-is ((PUSHCOLOR BLUE "text"), "\e[34mtext", '...and adding another level');
-is ((RESET BLUE "text"), "\e[0m\e[34mtext", '...and using reset');
-is ((POPCOLOR "text"), "\e[31m\e[42mtext", '...and POPCOLOR works');
-is ((LOCALCOLOR GREEN ON_BLUE "text"), "\e[32m\e[44mtext\e[31m\e[42m",
-    'LOCALCOLOR');
-$Term::ANSIColor::AUTOLOCAL = 1;
-is ((ON_BLUE "text"), "\e[44mtext\e[31m\e[42m", 'AUTOLOCAL');
-$Term::ANSIColor::AUTOLOCAL = 0;
-is ((POPCOLOR "text"), "\e[0mtext", 'POPCOLOR with empty stack');
-
-# Test push and pop support with the syntax from the original openmethods.com
-# submission, which uses a different coding style.
-is (PUSHCOLOR (RED ON_GREEN), "\e[31m\e[42m",
-    'PUSHCOLOR with explict argument');
-is (PUSHCOLOR (BLUE), "\e[34m", '...and another explicit argument');
-is (RESET . BLUE . "text", "\e[0m\e[34mtext",
-    '...and constants with concatenation');
-is (POPCOLOR . "text", "\e[31m\e[42mtext",
-    '...and POPCOLOR works without an argument');
-is (LOCALCOLOR(GREEN . ON_BLUE . "text"), "\e[32m\e[44mtext\e[31m\e[42m",
-    'LOCALCOLOR with two arguments');
-is (POPCOLOR . "text", "\e[0mtext", 'POPCOLOR with no arguments');
-
-# Test colorstrip.
-is (colorstrip ("\e[1mBold \e[31;42mon green\e[0m\e[m"), 'Bold on green',
-    'Basic color stripping');
-is (colorstrip ("\e[1m", 'bold', "\e[0m"), 'bold',
-    'Color stripping across multiple strings');
-is_deeply ([ colorstrip ("\e[1m", 'bold', "\e[0m") ],
-           [ '', 'bold', '' ], '...and in an array context');
-is (colorstrip ("\e[2cSome other code\e and stray [0m stuff"),
-    "\e[2cSome other code\e and stray [0m stuff",
-    'colorstrip does not remove non-color stuff');
-
-# Test colorvalid.
-is (colorvalid ("blue bold dark", "blink on_green"), 1,
-    'colorvalid returns true for valid attributes');
-is (colorvalid ("green orange"), undef,
-    '...and false for invalid attributes');
-
-# Test error handling.
-my $output = eval { color 'chartreuse' };
-is ($output, undef, 'color on unknown color name fails');
-like ($@, qr/^Invalid attribute name chartreuse at /,
-      '...with the right error');
-$output = eval { colored "Stuff", 'chartreuse' };
-is ($output, undef, 'colored on unknown color name fails');
-like ($@, qr/^Invalid attribute name chartreuse at /,
-      '...with the right error');
-$output = eval { uncolor "\e[28m" };
-is ($output, undef, 'uncolor on unknown color code fails');
-like ($@, qr/^No name for escape sequence 28 at /, '...with the right error');
-$output = eval { uncolor "\e[foom" };
-is ($output, undef, 'uncolor on bad escape sequence fails');
-like ($@, qr/^Bad escape sequence foo at /, '...with the right error');
-
-# Test error reporting when calling unrecognized Term::ANSIColor subs that go
-# through AUTOLOAD.
-eval { Term::ANSIColor::RSET () };
-like ($@, qr/^undefined subroutine \&Term::ANSIColor::RSET called at /,
-      'Correct error from an attribute that is not defined');
-eval { Term::ANSIColor::reset () };
-like ($@, qr/^undefined subroutine \&Term::ANSIColor::reset called at /,
-      'Correct error from a lowercase attribute');
-
-# Ensure that we still get proper error reporting for unknown constants when
-# when colors are disabled.
-$ENV{ANSI_COLORS_DISABLED} = 1;
-eval { Term::ANSIColor::RSET () };
-like ($@, qr/^undefined subroutine \&Term::ANSIColor::RSET called at /,
-      'Correct error from undefined attribute with disabled colors');
-delete $ENV{ANSI_COLORS_DISABLED};
@@ -0,0 +1,18 @@
+# Configuration for Perl tests.  -*- perl -*-
+
+# The level of coverage achieved by the test suite.
+$COVERAGE_LEVEL = 100;
+
+# Skip taint tests when doing coverage analysis since Devel::Cover can't
+# handle taint checking.
+@COVERAGE_SKIP_TESTS = qw(taint);
+
+# Default minimum version requirement.
+$MINIMUM_VERSION = '5.006';
+
+# Some of the constant subs are documented but not in a way that
+# Test::Pod::Coverage can understand.
+@POD_COVERAGE_EXCLUDE = (qr{ \A \w+ COLOR \z }xms);
+
+# File must end with this line.
+1;
@@ -0,0 +1,100 @@
+# -*- conf -*-
+#
+# Default configuration for perlcritic.  Be sure to copy this into the source
+# for packages that run perlcritic tests automatically during the build for
+# reproducible test results.
+#
+# This file has been updated to match perlcritic 1.118.
+#
+# The canonical version of this file is maintained in the rra-c-util package,
+# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2011, 2012, 2013
+#     The Board of Trustees of the Leland Stanford Junior University
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+severity = 1
+verbose  = %f:%l:%c: [%p] %m (%e, Severity: %s)\n
+
+# I prefer this policy (a lot, actually), but other people in my group at
+# Stanford really didn't like it, so this is my compromise to agree with a
+# group coding style.
+[-CodeLayout::ProhibitParensWithBuiltins]
+
+# Stanford's coding style allows postfix unless for flow control.  There
+# doesn't appear to be any way to allow it only for flow control (the logic
+# for "if" and "when" appears to be special-cased), so we have to allow unless
+# globally.
+[ControlStructures::ProhibitPostfixControls]
+allow = unless
+
+# This is handled with a separate test case that uses Test::Spelling.
+[-Documentation::PodSpelling]
+
+# Pod::Man and Pod::Text fixed this bug years ago.  I know, I maintain them.
+[-Documentation::RequirePodLinksIncludeText]
+
+# The POD sections Perl::Critic wants are incompatible with the POD template
+# from perlpodstyle, which is what I use for my POD documentation.
+[-Documentation::RequirePodSections]
+
+# This problem was fixed in Perl 5.14, which now properly preserves the value
+# of $@ even if destructors run at exit from the eval block.
+[-ErrorHandling::RequireCheckingReturnValueOfEval]
+
+# The default of 9 is too small and forces weird code contortions.
+[InputOutput::RequireBriefOpen]
+lines = 25
+
+# This is correct 80% of the time, but it isn't correct for a lot of scripts
+# inside packages, where maintaining $VERSION isn't worth the effort.
+# Unfortunately, there's no way to override it, so it gets turned off
+# globally.
+[-Modules::RequireVersionVar]
+
+# This sounds interesting but is actually useless.  Any large blocks of
+# literal text, which does not add to the complexity of the regex, will set it
+# off.
+[-RegularExpressions::ProhibitComplexRegexes]
+
+# I generally don't want to require Readonly as a prerequisite for all my Perl
+# modules.
+[-ValuesAndExpressions::ProhibitConstantPragma]
+
+# A good idea, but there are too many places where this would be more
+# confusing than helpful.  Pull out numbers if one might change them
+# independent of the algorithm, but don't do so for mathematical formulae.
+[-ValuesAndExpressions::ProhibitMagicNumbers]
+
+# Increase this to six digits so that I'm not told to add underscores to
+# port numbers (which is just silly).
+[ValuesAndExpressions::RequireNumberSeparators]
+min_value = 100000
+
+# Text::Wrap has a broken interface that requires use of package variables.
+[Variables::ProhibitPackageVars]
+add_packages = Text::Wrap
+
+# use English was one of the worst ideas in the history of Perl.  It makes the
+# code slightly more readable for amateurs at the cost of confusing
+# experienced Perl programmers and sending people in futile quests for where
+# these magical global variables are defined.
+[-Variables::ProhibitPunctuationVars]
@@ -0,0 +1,14 @@
+# -*- conf -*-
+#
+# Default options for perltidy for proper Perl code reformatting.
+#
+# The canonical version of this file is maintained in the rra-c-util package,
+# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+
+-bbao           # put line breaks before any operator
+-nbbc           # don't force blank lines before comments (bad for else blocks)
+-ce             # cuddle braces around else
+-l=79           # usually use 78, but don't want 79-long lines reformatted
+-pt=2           # don't add extra whitespace around parentheses
+-sbt=2          # ...or square brackets
+-sfs            # no space before semicolon in for (not that I use this form)
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+#
+# Test that all methods are documented in POD.
+#
+# The canonical version of this file is maintained in the rra-c-util package,
+# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2013, 2014
+#     The Board of Trustees of the Leland Stanford Junior University
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+use 5.006;
+use strict;
+use warnings;
+
+use lib 't/lib';
+
+use Test::More;
+use Test::RRA qw(skip_unless_automated use_prereq);
+use Test::RRA::Config qw(@POD_COVERAGE_EXCLUDE);
+
+# Skip for normal user installs since this doesn't affect functionality.
+skip_unless_automated('POD coverage tests');
+
+# Load prerequisite modules.
+use_prereq('Test::Pod::Coverage');
+
+# Test everything found in the distribution.
+all_pod_coverage_ok({ also_private => [@POD_COVERAGE_EXCLUDE] });
@@ -0,0 +1,66 @@
+#!/usr/bin/perl
+#
+# Check for spelling errors in POD documentation.
+#
+# The canonical version of this file is maintained in the rra-c-util package,
+# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2013, 2014
+#     The Board of Trustees of the Leland Stanford Junior University
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+use 5.006;
+use strict;
+use warnings;
+
+use lib 't/lib';
+
+use Test::More;
+use Test::RRA qw(skip_unless_author use_prereq);
+
+# Only run this test for the module author since the required stopwords are
+# too sensitive to the exact spell-checking program and dictionary.
+skip_unless_author('Spelling tests');
+
+# Load prerequisite modules.
+use_prereq('Test::Spelling');
+
+# Check all POD in the Perl distribution.  Add the examples directory if it
+# exists.  Also add any files in usr/bin or usr/sbin, which are widely used in
+# Stanford-internal packages.
+my @files = all_pod_files();
+if (-d 'examples') {
+    push(@files, all_pod_files('examples'));
+}
+for my $dir (qw(usr/bin usr/sbin)) {
+    if (-d $dir) {
+        push(@files, glob("$dir/*"));
+    }
+}
+
+# We now have a list of all files to check, so output a plan and run the
+# tests.  We can't use all_pod_files_spelling_ok because it refuses to check
+# non-Perl files and Stanford-internal packages have a lot of shell scripts
+# with POD documentation.
+plan tests => scalar(@files);
+for my $file (@files) {
+    pod_file_spelling_ok($file);
+}
@@ -0,0 +1,65 @@
+#!/usr/bin/perl
+#
+# Check all POD documents for POD formatting errors.
+#
+# The canonical version of this file is maintained in the rra-c-util package,
+# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2012, 2013, 2014
+#     The Board of Trustees of the Leland Stanford Junior University
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+use 5.006;
+use strict;
+use warnings;
+
+use lib 't/lib';
+
+use Test::More;
+use Test::RRA qw(skip_unless_automated use_prereq);
+
+# Skip this test for normal user installs, although pod2man may still fail.
+skip_unless_automated('POD syntax tests');
+
+# Load prerequisite modules.
+use_prereq('Test::Pod');
+
+# Check all POD in the Perl distribution.  Add the examples directory if it
+# exists.  Also add any files in usr/bin or usr/sbin, which are widely used in
+# Stanford-internal packages.
+my @files = all_pod_files();
+if (-d 'examples') {
+    push(@files, all_pod_files('examples'));
+}
+for my $dir (qw(usr/bin usr/sbin)) {
+    if (-d $dir) {
+        push(@files, glob("$dir/*"));
+    }
+}
+
+# We now have a list of all files to check, so output a plan and run the
+# tests.  We can't use all_pod_files_ok because it refuses to check non-Perl
+# files and Stanford-internal packages have a lot of shell scripts with POD
+# documentation.
+plan tests => scalar(@files);
+for my $file (@files) {
+    pod_file_ok($file);
+}
@@ -0,0 +1,60 @@
+#!/usr/bin/perl
+#
+# Check the SYNOPSIS section of the documentation for syntax errors.
+#
+# The canonical version of this file is maintained in the rra-c-util package,
+# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2013, 2014
+#     The Board of Trustees of the Leland Stanford Junior University
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+use 5.006;
+use strict;
+use warnings;
+
+use lib 't/lib';
+
+use Test::More;
+use Test::RRA qw(skip_unless_automated use_prereq);
+
+# Skip for normal user installs since this doesn't affect functionality.
+skip_unless_automated('Synopsis syntax tests');
+
+# Load prerequisite modules.
+use_prereq('Perl::Critic::Utils');
+use_prereq('Test::Synopsis');
+
+# The default Test::Synopsis all_synopsis_ok() function requires that the
+# module be in a lib directory.  Use Perl::Critic::Utils to find the modules
+# in blib, or lib if it doesn't exist.  However, strip out anything in
+# blib/script, since scripts use a different SYNOPSIS syntax.
+my @files = Perl::Critic::Utils::all_perl_files('blib');
+@files = grep { !m{blib/script/}xms } @files;
+if (!@files) {
+    @files = Perl::Critic::Utils::all_perl_files('lib');
+}
+plan tests => scalar @files;
+
+# Run the actual tests.
+for my $file (@files) {
+    synopsis_ok($file);
+}
@@ -1,25 +0,0 @@
-#!/usr/bin/perl -Tw
-#
-# t/eval.t -- Test suite for $@ preservation with constants.
-#
-# Copyright 2012 Russ Allbery <rra@stanford.edu>
-#
-# This program is free software; you may redistribute it and/or modify it
-# under the same terms as Perl itself.
-
-use strict;
-use Test::More tests => 5;
-
-BEGIN {
-    delete $ENV{ANSI_COLORS_DISABLED};
-    use_ok ('Term::ANSIColor', qw/:constants/);
-}
-
-# Ensure that using a constant doesn't leak anything in $@.
-is ((BOLD 'test'), "\e[1mtest", 'BOLD works');
-is ($@, '', '... and $@ is empty');
-
-# Store something in $@ and ensure it doesn't get clobbered.
-eval 'sub { syntax';
-is ((BLINK 'test'), "\e[5mtest", 'BLINK works after eval failure');
-isnt ($@, '', '... and $@ still contains something useful');
@@ -0,0 +1,218 @@
+# Configuration for Perl test cases.
+#
+# In order to reuse the same Perl test cases in multiple packages, I use a
+# configuration file to store some package-specific data.  This module loads
+# that configuration and provides the namespace for the configuration
+# settings.
+#
+# The canonical version of this file is maintained in the rra-c-util package,
+# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+
+package Test::RRA::Config;
+
+use 5.006;
+use strict;
+use warnings;
+
+# For Perl 5.006 compatibility.
+## no critic (ClassHierarchies::ProhibitExplicitISA)
+
+use Exporter;
+use Test::More;
+
+# Declare variables that should be set in BEGIN for robustness.
+our (@EXPORT_OK, @ISA, $VERSION);
+
+# Set $VERSION and everything export-related in a BEGIN block for robustness
+# against circular module loading (not that we load any modules, but
+# consistency is good).
+BEGIN {
+    @ISA       = qw(Exporter);
+    @EXPORT_OK = qw(
+      $COVERAGE_LEVEL @COVERAGE_SKIP_TESTS @CRITIC_IGNORE $LIBRARY_PATH
+      $MINIMUM_VERSION %MINIMUM_VERSION @POD_COVERAGE_EXCLUDE @STRICT_IGNORE
+      @STRICT_PREREQ
+    );
+
+    # This version should match the corresponding rra-c-util release, but with
+    # two digits for the minor version, including a leading zero if necessary,
+    # so that it will sort properly.
+    $VERSION = '5.04';
+}
+
+# If BUILD or SOURCE are set in the environment, look for data/perl.conf under
+# those paths for a C Automake package.  Otherwise, look in t/data/perl.conf
+# for a standalone Perl module.  Don't use Test::RRA::Automake since it may
+# not exist.
+our $PATH;
+for my $base ($ENV{BUILD}, $ENV{SOURCE}, 't') {
+    next if !defined($base);
+    my $path = "$base/data/perl.conf";
+    if (-r $path) {
+        $PATH = $path;
+        last;
+    }
+}
+if (!defined($PATH)) {
+    BAIL_OUT('cannot find data/perl.conf');
+}
+
+# Pre-declare all of our variables and set any defaults.
+our $COVERAGE_LEVEL = 100;
+our @COVERAGE_SKIP_TESTS;
+our @CRITIC_IGNORE;
+our $LIBRARY_PATH;
+our $MINIMUM_VERSION = '5.008';
+our %MINIMUM_VERSION;
+our @POD_COVERAGE_EXCLUDE;
+our @STRICT_IGNORE;
+our @STRICT_PREREQ;
+
+# Load the configuration.
+if (!do($PATH)) {
+    my $error = $@ || $! || 'loading file did not return true';
+    BAIL_OUT("cannot load data/perl.conf: $error");
+}
+
+1;
+__END__
+
+=for stopwords
+Allbery rra-c-util Automake perlcritic .libs namespace subdirectory
+sublicense MERCHANTABILITY NONINFRINGEMENT
+
+=head1 NAME
+
+Test::RRA::Config - Perl test configuration
+
+=head1 SYNOPSIS
+
+    use Test::RRA::Config qw($MINIMUM_VERSION);
+    print "Required Perl version is $MINIMUM_VERSION\n";
+
+=head1 DESCRIPTION
+
+Test::RRA::Config encapsulates per-package configuration for generic Perl
+test programs that are shared between multiple packages using the
+rra-c-util infrastructure.  It handles locating and loading the test
+configuration file for both C Automake packages and stand-alone Perl
+modules.
+
+Test::RRA::Config looks for a file named F<data/perl.conf> relative to the
+root of the test directory.  That root is taken from the environment
+variables BUILD or SOURCE (in that order) if set, which will be the case
+for C Automake packages using C TAP Harness.  If neither is set, it
+expects the root of the test directory to be a directory named F<t>
+relative to the current directory, which will be the case for stand-alone
+Perl modules.
+
+The following variables are supported:
+
+=over 4
+
+=item $COVERAGE_LEVEL
+
+The coverage level achieved by the test suite for Perl test coverage
+testing using Test::Strict, as a percentage.  The test will fail if test
+coverage less than this percentage is achieved.  If not given, defaults
+to 100.
+
+=item @COVERAGE_SKIP_TESTS
+
+Directories under F<t> whose tests should be skipped when doing coverage
+testing.  This can be tests that won't contribute to coverage or tests
+that don't run properly under Devel::Cover for some reason (such as ones
+that use taint checking).  F<docs> and F<style> will always be skipped
+regardless of this setting.
+
+=item @CRITIC_IGNORE
+
+Additional directories to ignore when doing recursive perlcritic testing.
+The contents of this directory must be either top-level directory names or
+directory names starting with F<tests/>.
+
+=item $LIBRARY_PATH
+
+Add this directory (or a F<.libs> subdirectory) relative to the top of the
+source tree to LD_LIBRARY_PATH when checking the syntax of Perl modules.
+This may be required to pick up libraries that are used by in-tree Perl
+modules so that Perl scripts can pass a syntax check.
+
+=item $MINIMUM_VERSION
+
+Default minimum version requirement for included Perl scripts.  If not
+given, defaults to 5.008.
+
+=item %MINIMUM_VERSION
+
+Minimum version exceptions for specific directories.  The keys should be
+minimum versions of Perl to enforce.  The value for each key should be a
+reference to an array of either top-level directory names or directory
+names starting with F<tests/>.  All files in those directories will have
+that minimum Perl version constraint imposed instead of $MINIMUM_VERSION.
+
+=item @POD_COVERAGE_EXCLUDE
+
+Regexes that match method names that should be excluded from POD coverage
+testing.  Normally, all methods have to be documented in the POD for a
+Perl module, but methods matching any of these regexes will be considered
+private and won't require documentation.
+
+=item @STRICT_IGNORE
+
+Additional directories to ignore when doing recursive Test::Strict testing
+for C<use strict> and C<use warnings>.  The contents of this directory
+must be either top-level directory names or directory names starting with
+F<tests/>.
+
+=item @STRICT_PREREQ
+
+A list of Perl modules that have to be available in order to do meaningful
+Test::Strict testing.  If any of the modules cannot be loaded via C<use>,
+Test::Strict checking will be skipped.  There is currently no way to
+require specific versions of the modules.
+
+=back
+
+No variables are exported by default, but the variables can be imported
+into the local namespace to avoid long variable names.
+
+=head1 AUTHOR
+
+Russ Allbery <eagle@eyrie.org>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2013, 2014 The Board of Trustees of the Leland Stanford Junior
+University
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+=head1 SEE ALSO
+
+perlcritic(1), Test::MinimumVersion(3), Test::RRA(3),
+Test::RRA::Automake(3), Test::Strict(3)
+
+This module is maintained in the rra-c-util package.  The current version
+is available from L<http://www.eyrie.org/~eagle/software/rra-c-util/>.
+
+The C TAP Harness test driver and libraries for TAP-based C testing are
+available from L<http://www.eyrie.org/~eagle/software/c-tap-harness/>.
+
+=cut
@@ -0,0 +1,260 @@
+# Helper functions for test programs written in Perl.
+#
+# This module provides a collection of helper functions used by test programs
+# written in Perl.  This is a general collection of functions that can be used
+# by both C packages with Automake and by stand-alone Perl modules.  See
+# Test::RRA::Automake for additional functions specifically for C Automake
+# distributions.
+#
+# The canonical version of this file is maintained in the rra-c-util package,
+# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2013, 2014
+#     The Board of Trustees of the Leland Stanford Junior University
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+package Test::RRA;
+
+use 5.006;
+use strict;
+use warnings;
+
+use Exporter;
+use Test::More;
+
+# For Perl 5.006 compatibility.
+## no critic (ClassHierarchies::ProhibitExplicitISA)
+
+# Declare variables that should be set in BEGIN for robustness.
+our (@EXPORT_OK, @ISA, $VERSION);
+
+# Set $VERSION and everything export-related in a BEGIN block for robustness
+# against circular module loading (not that we load any modules, but
+# consistency is good).
+BEGIN {
+    @ISA       = qw(Exporter);
+    @EXPORT_OK = qw(skip_unless_author skip_unless_automated use_prereq);
+
+    # This version should match the corresponding rra-c-util release, but with
+    # two digits for the minor version, including a leading zero if necessary,
+    # so that it will sort properly.
+    $VERSION = '5.04';
+}
+
+# Skip this test unless author tests are requested.  Takes a short description
+# of what tests this script would perform, which is used in the skip message.
+# Calls plan skip_all, which will terminate the program.
+#
+# $description - Short description of the tests
+#
+# Returns: undef
+sub skip_unless_author {
+    my ($description) = @_;
+    if (!$ENV{AUTHOR_TESTING}) {
+        plan skip_all => "$description only run for author";
+    }
+    return;
+}
+
+# Skip this test unless doing automated testing or release testing.  This is
+# used for tests that should be run by CPAN smoke testing or during releases,
+# but not for manual installs by end users.  Takes a short description of what
+# tests this script would perform, which is used in the skip message.  Calls
+# plan skip_all, which will terminate the program.
+#
+# $description - Short description of the tests
+#
+# Returns: undef
+sub skip_unless_automated {
+    my ($description) = @_;
+    for my $env (qw(AUTOMATED_TESTING RELEASE_TESTING AUTHOR_TESTING)) {
+        return if $ENV{$env};
+    }
+    plan skip_all => "$description normally skipped";
+    return;
+}
+
+# Attempt to load a module and skip the test if the module could not be
+# loaded.  If the module could be loaded, call its import function manually.
+# If the module could not be loaded, calls plan skip_all, which will terminate
+# the program.
+#
+# The special logic here is based on Test::More and is required to get the
+# imports to happen in the caller's namespace.
+#
+# $module  - Name of the module to load
+# @imports - Any arguments to import, possibly including a version
+#
+# Returns: undef
+sub use_prereq {
+    my ($module, @imports) = @_;
+
+    # If the first import looks like a version, pass it as a bare string.
+    my $version = q{};
+    if (@imports >= 1 && $imports[0] =~ m{ \A \d+ (?: [.][\d_]+ )* \z }xms) {
+        $version = shift(@imports);
+    }
+
+    # Get caller information to put imports in the correct package.
+    my ($package) = caller;
+
+    # Do the import with eval, and try to isolate it from the surrounding
+    # context as much as possible.  Based heavily on Test::More::_eval.
+    ## no critic (BuiltinFunctions::ProhibitStringyEval)
+    ## no critic (ValuesAndExpressions::ProhibitImplicitNewlines)
+    my ($result, $error, $sigdie);
+    {
+        local $@            = undef;
+        local $!            = undef;
+        local $SIG{__DIE__} = undef;
+        $result = eval qq{
+            package $package;
+            use $module $version \@imports;
+            1;
+        };
+        $error = $@;
+        $sigdie = $SIG{__DIE__} || undef;
+    }
+
+    # If the use failed for any reason, skip the test.
+    if (!$result || $error) {
+        my $name = length($version) > 0 ? "$module $version" : $module;
+        plan skip_all => "$name required for test";
+    }
+
+    # If the module set $SIG{__DIE__}, we cleared that via local.  Restore it.
+    ## no critic (Variables::RequireLocalizedPunctuationVars)
+    if (defined($sigdie)) {
+        $SIG{__DIE__} = $sigdie;
+    }
+    return;
+}
+
+1;
+__END__
+
+=for stopwords
+Allbery Allbery's DESC bareword sublicense MERCHANTABILITY NONINFRINGEMENT
+rra-c-util
+
+=head1 NAME
+
+Test::RRA - Support functions for Perl tests
+
+=head1 SYNOPSIS
+
+    use Test::RRA
+      qw(skip_unless_author skip_unless_automated use_prereq);
+
+    # Skip this test unless author tests are requested.
+    skip_unless_author('Coding style tests');
+
+    # Skip this test unless doing automated or release testing.
+    skip_unless_automated('POD syntax tests');
+
+    # Load modules, skipping the test if they're not available.
+    use_prereq('Perl6::Slurp', 'slurp');
+    use_prereq('Test::Script::Run', '0.04');
+
+=head1 DESCRIPTION
+
+This module collects utility functions that are useful for Perl test
+scripts.  It assumes Russ Allbery's Perl module layout and test
+conventions and will only be useful for other people if they use the
+same conventions.
+
+=head1 FUNCTIONS
+
+None of these functions are imported by default.  The ones used by a
+script should be explicitly imported.
+
+=over 4
+
+=item skip_unless_author(DESC)
+
+Checks whether AUTHOR_TESTING is set in the environment and skips the
+whole test (by calling C<plan skip_all> from Test::More) if it is not.
+DESC is a description of the tests being skipped.  A space and C<only run
+for author> will be appended to it and used as the skip reason.
+
+=item skip_unless_automated(DESC)
+
+Checks whether AUTHOR_TESTING, AUTOMATED_TESTING, or RELEASE_TESTING are
+set in the environment and skips the whole test (by calling C<plan
+skip_all> from Test::More) if they are not.  This should be used by tests
+that should not run during end-user installs of the module, but which
+should run as part of CPAN smoke testing and release testing.
+
+DESC is a description of the tests being skipped.  A space and C<normally
+skipped> will be appended to it and used as the skip reason.
+
+=item use_prereq(MODULE[, VERSION][, IMPORT ...])
+
+Attempts to load MODULE with the given VERSION and import arguments.  If
+this fails for any reason, the test will be skipped (by calling C<plan
+skip_all> from Test::More) with a skip reason saying that MODULE is
+required for the test.
+
+VERSION will be passed to C<use> as a version bareword if it looks like a
+version number.  The remaining IMPORT arguments will be passed as the
+value of an array.
+
+=back
+
+=head1 AUTHOR
+
+Russ Allbery <eagle@eyrie.org>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2013, 2014 The Board of Trustees of the Leland Stanford Junior
+University
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+=head1 SEE ALSO
+
+Test::More(3), Test::RRA::Automake(3), Test::RRA::Config(3)
+
+This module is maintained in the rra-c-util package.  The current version
+is available from L<http://www.eyrie.org/~eagle/software/rra-c-util/>.
+
+The functions to control when tests are run use environment variables
+defined by the L<Lancaster
+Consensus|https://github.com/Perl-Toolchain-Gang/toolchain-site/blob/master/lancaster-consensus.md>.
+
+=cut
@@ -0,0 +1,81 @@
+#!/usr/bin/perl
+#
+# Test setting color aliases via the environment.
+#
+# Copyright 2012 Stephen Thirlwall
+# Copyright 2012, 2014 Russ Allbery <rra@cpan.org>
+#
+# This program is free software; you may redistribute it and/or modify it
+# under the same terms as Perl itself.
+
+use 5.006;
+use strict;
+use warnings;
+
+use lib 't/lib';
+
+use Test::More;
+use Test::RRA qw(use_prereq);
+
+# Load prerequisite modules.
+use_prereq('Test::Warn');
+
+# Print out our plan.
+plan tests => 19;
+
+# Ensure we don't pick up a setting from the user's environment.
+delete $ENV{ANSI_COLORS_DISABLED};
+
+# Set up some custom color configuration.  The last four will produce warnings
+# on module load.
+my @COLOR_ALIASES = (
+    ' custom_black = black',  'custom_red= red',
+    'custom_green =green ',   'custom_blue=blue',
+    'custom_unknown=unknown', '=no_new',
+    'no_old=',                'no_equals',
+    'red=green',              'custom_test=red=blue',
+    'custom!test=red',
+);
+local $ENV{ANSI_COLORS_ALIASES} = join(q{,}, @COLOR_ALIASES);
+
+# Load the module, which should produce those warnings.
+my $require_sub = sub { require_ok('Term::ANSIColor') };
+warnings_like(
+    $require_sub,
+    [
+        qr{ \A Invalid [ ] attribute [ ] name [ ] "unknown" [ ] in [ ]
+            "custom_unknown=unknown" [ ] at [ ] }xms,
+        qr{ \A Bad [ ] color [ ] mapping [ ] "=no_new" [ ] at [ ]   }xms,
+        qr{ \A Bad [ ] color [ ] mapping [ ] "no_old=" [ ] at [ ]   }xms,
+        qr{ \A Bad [ ] color [ ] mapping [ ] "no_equals" [ ] at [ ] }xms,
+        qr{ \A Cannot [ ] alias [ ] standard [ ] color [ ] "red" [ ] in
+            [ ] "red=green" [ ] at [ ] }xms,
+        qr{ \A Invalid [ ] attribute [ ] name [ ] "red=blue" [ ] in [ ]
+            "custom_test=red=blue" [ ] at [ ] }xms,
+        qr{ \A Invalid [ ] alias [ ] name [ ] "custom!test" [ ] in [ ]
+            "custom!test=red" [ ] at [ ] }xms,
+    ],
+    'Correct warnings when loading module'
+);
+
+# Import the functions for convenience.
+Term::ANSIColor->import(qw(color colored colorvalid uncolor));
+
+# Check the custom colors all get assigned.  They use various spacing formats
+# and should all parse correctly.
+for my $original (qw(black red green blue)) {
+    my $custom = 'custom_' . $original;
+    ok(colorvalid($custom), "$custom is valid");
+    is(color($custom), color($original),
+        "...and matches $original with color");
+    is(
+        colored('test', $custom),
+        colored('test', $original),
+        "...and matches $original with colored"
+    );
+    is_deeply([uncolor(color($custom))],
+        [$original], "...and uncolor returns $original");
+}
+
+# custom_unknown is mapped to an unknown color and should not appear.
+is(colorvalid('custom_unknown'), undef, 'Unknown color mapping fails');
@@ -0,0 +1,88 @@
+#!/usr/bin/perl
+#
+# Test setting color aliases via the function interface.
+#
+# Copyright 2012 Russ Allbery <rra@cpan.org>
+#
+# This program is free software; you may redistribute it and/or modify it
+# under the same terms as Perl itself.
+
+use strict;
+use warnings;
+
+use Test::More tests => 23;
+
+# Load the module.
+BEGIN {
+    delete $ENV{ANSI_COLORS_ALIASES};
+    delete $ENV{ANSI_COLORS_DISABLED};
+    use_ok('Term::ANSIColor', qw(color colored colorvalid uncolor coloralias));
+}
+
+# Confirm our test alias doesn't exist.
+my $output = eval { color('alert') };
+ok(!$output, 'alert color not recognized');
+like(
+    $@,
+    qr{ \A Invalid [ ] attribute [ ] name [ ] alert [ ] at [ ] }xms,
+    '...with the right error'
+);
+
+# Basic alias functionality.
+is(coloralias('alert', 'red'), 'red', 'coloralias works and returns color');
+is(color('alert'), color('red'), 'alert now works as a color');
+is(colored('test', 'alert'), "\e[31mtest\e[0m", '..and colored works');
+ok(colorvalid('alert'), '...and alert is now a valid color');
+is(coloralias('alert'), 'red', 'coloralias with one arg returns value');
+
+# The alias can be changed.
+is(coloralias('alert', 'green'), 'green', 'changing the alias works');
+is(coloralias('alert'), 'green',        '...and changed the mapping');
+is(color('alert'),      color('green'), '...and now returns its new value');
+
+# uncolor ignores aliases.
+is_deeply([uncolor("\e[32m")], ['green'], 'uncolor ignores aliases');
+
+# Asking for the value of an unknown alias returns undef.
+is(coloralias('warning'), undef, 'coloralias on unknown alias returns undef');
+
+# Invalid alias names.
+$output = eval { coloralias('foo;bar', 'green') };
+ok(!$output, 'invalid alias name rejected');
+like(
+    $@,
+    qr{ \A Invalid [ ] alias [ ] name [ ] "foo;bar" [ ] at [ ] }xms,
+    '...with the right error'
+);
+$output = eval { coloralias(q{}, 'green') };
+ok(!$output, 'empty alias name rejected');
+like(
+    $@,
+    qr{ \A Invalid [ ] alias [ ] name [ ] "" [ ] at [ ] }xms,
+    '...with the right error'
+);
+
+# Aliasing an existing color.
+$output = eval { coloralias('red', 'green') };
+ok(!$output, 'aliasing an existing color rejected');
+like(
+    $@,
+    qr{ \A Cannot [ ] alias [ ] standard [ ] color [ ] "red" [ ] at [ ] }xms,
+    '...with the right error'
+);
+
+# Aliasing to a color that doesn't exist, or to another alias.
+$output = eval { coloralias('warning', 'chartreuse') };
+ok(!$output, 'aliasing to an unknown color rejected');
+like(
+    $@,
+    qr{ \A Invalid [ ] attribute [ ] name [ ] "chartreuse" [ ] at [ ] }xms,
+    '...with the right error'
+);
+$output = eval { coloralias('warning', 'alert') };
+ok(!$output, 'aliasing to an alias rejected');
+like(
+    $@,
+    qr{ \A Invalid [ ] attribute [ ] name [ ] "alert" [ ] at [ ] }xms,
+    '...with the right error'
+);
@@ -0,0 +1,369 @@
+#!/usr/bin/perl
+#
+# Basic test suite for the Term::ANSIColor Perl module.
+#
+# Copyright 1997, 1998, 2000, 2001, 2002, 2005, 2006, 2009, 2010, 2012, 2014
+#     Russ Allbery <rra@cpan.org>
+#
+# This program is free software; you may redistribute it and/or modify it
+# under the same terms as Perl itself.
+
+use strict;
+use warnings;
+
+use Test::More tests => 152;
+
+# Load the module.
+BEGIN {
+    delete $ENV{ANSI_COLORS_ALIASES};
+    delete $ENV{ANSI_COLORS_DISABLED};
+    use_ok('Term::ANSIColor',
+        qw(:pushpop color colored uncolor colorstrip colorvalid));
+}
+
+# Various basic tests.
+is(color('blue on_green', 'bold'), "\e[34;42;1m", 'Simple attributes');
+is(colored('testing', 'blue', 'bold'), "\e[34;1mtesting\e[0m", 'colored');
+is((BLUE BOLD 'testing'), "\e[34m\e[1mtesting", 'Constants');
+is(join(q{}, BLUE, BOLD, 'testing'),
+    "\e[34m\e[1mtesting", 'Constants with commas');
+is((BLUE 'test', 'ing'), "\e[34mtesting", 'Constants with multiple strings');
+
+# Test case variations on attributes.
+is(color('Blue BOLD', 'on_GReeN'), "\e[34;1;42m", 'Attribute case');
+
+# color should return undef if there were no attributes.
+is(color(), undef, 'color returns undef with no attributes');
+
+# Autoreset after the end of a command string.
+$Term::ANSIColor::AUTORESET = 1;
+is((BLUE BOLD 'testing'), "\e[34m\e[1mtesting\e[0m\e[0m", 'AUTORESET');
+is((BLUE BOLD, 'te', 'st'), "\e[34m\e[1mtest\e[0m", 'AUTORESET with commas');
+$Term::ANSIColor::AUTORESET = 0;
+
+# Reset after each line terminator.
+$Term::ANSIColor::EACHLINE = "\n";
+is(colored("test\n\ntest", 'bold'),
+    "\e[1mtest\e[0m\n\n\e[1mtest\e[0m", 'EACHLINE');
+$Term::ANSIColor::EACHLINE = "\r\n";
+is(
+    colored("test\ntest\r\r\n\r\n", 'bold'),
+    "\e[1mtest\ntest\r\e[0m\r\n\r\n",
+    'EACHLINE with multiple delimiters'
+);
+$Term::ANSIColor::EACHLINE = "\n";
+is(
+    colored(['bold', 'on_green'], "test\n", "\n", 'test'),
+    "\e[1;42mtest\e[0m\n\n\e[1;42mtest\e[0m",
+    'colored with reference to array'
+);
+
+# Basic tests for uncolor.
+is_deeply([uncolor('1;42', "\e[m", q{}, "\e[0m")],
+    [qw(bold on_green clear)], 'uncolor');
+is_deeply([uncolor("\e[01m")], ['bold'], 'uncolor("\\e[01m")');
+is_deeply([uncolor("\e[m")],   [],       'uncolor("\\e[m")');
+is_deeply([uncolor(q{})],      [],       'uncolor("")');
+
+# Several tests for ANSI_COLORS_DISABLED.
+local $ENV{ANSI_COLORS_DISABLED} = 1;
+is(color('blue'), q{}, 'color support for ANSI_COLORS_DISABLED');
+is(colored('testing', 'blue', 'on_red'),
+    'testing', 'colored support for ANSI_COLORS_DISABLED');
+is((GREEN 'testing'), 'testing', 'Constant support for ANSI_COLORS_DISABLED');
+delete $ENV{ANSI_COLORS_DISABLED};
+
+# Earlier versions of Term::ANSIColor didn't support ANSI_COLORS_DISABLED if
+# the constant had been created before the environment variable was set.  Test
+# all the ones we're going to use to get full test coverage.
+local $ENV{ANSI_COLORS_DISABLED} = 1;
+is((BLUE 'testing'), 'testing', 'ANSI_COLORS_DISABLED with existing constant');
+delete $ENV{ANSI_COLORS_DISABLED};
+
+# If ANSI_COLORS_DISABLED is set to a false value or the empty string, it
+# should not take effect.
+local $ENV{ANSI_COLORS_DISABLED} = 0;
+is(color('bold'), "\e[1m", 'ANSI_COLORS_DISABLED must be true');
+is((BOLD),        "\e[1m", '...likewise for constants');
+local $ENV{ANSI_COLORS_DISABLED} = q{};
+is(color('bold'), "\e[1m", '...likewise when set to an empty string');
+is((BOLD),        "\e[1m", '...likewise for constants');
+delete $ENV{ANSI_COLORS_DISABLED};
+
+# Make sure DARK is exported.  This was omitted in versions prior to 1.07.
+is((DARK 'testing'), "\e[2mtesting", 'DARK');
+
+# Check faint as a synonym for dark.
+is(colored('test', 'faint'), "\e[2mtest\e[0m", 'colored supports faint');
+is((FAINT 'test'), "\e[2mtest", '...and the FAINT constant works');
+
+# Test bright color support.
+is(color('bright_red'),    "\e[91m",      'Bright red is supported');
+is((BRIGHT_RED 'test'),    "\e[91mtest",  '...and as a constant');
+is(color('on_bright_red'), "\e[101m",     '...as is on bright red');
+is((ON_BRIGHT_RED 'test'), "\e[101mtest", '...and as a constant');
+
+# Test italic, which was added in 3.02.
+is(color('italic'), "\e[3m",     'Italic is supported');
+is((ITALIC 'test'), "\e[3mtest", '...and as a constant');
+
+# Test colored with 0 and EACHLINE.  Regression test for an incorrect use of a
+# truth check.
+$Term::ANSIColor::EACHLINE = "\n";
+is(colored('0', 'blue', 'bold'),
+    "\e[34;1m0\e[0m", 'colored with 0 and EACHLINE');
+is(
+    colored("0\n0\n\n", 'blue', 'bold'),
+    "\e[34;1m0\e[0m\n\e[34;1m0\e[0m\n\n",
+    'colored with 0, EACHLINE, and multiple lines'
+);
+
+# Test colored with the empty string and EACHLINE.
+is(colored(q{}, 'blue', 'bold'), q{}, 'colored w/empty string and EACHLINE');
+
+# Test push and pop support.
+is((PUSHCOLOR RED ON_GREEN 'text'),
+    "\e[31m\e[42mtext", 'PUSHCOLOR does not break constants');
+is((PUSHCOLOR BLUE 'text'), "\e[34mtext",       '...and adding another level');
+is((RESET BLUE 'text'),     "\e[0m\e[34mtext",  '...and using reset');
+is((POPCOLOR 'text'),       "\e[31m\e[42mtext", '...and POPCOLOR works');
+is((LOCALCOLOR GREEN ON_BLUE 'text'),
+    "\e[32m\e[44mtext\e[31m\e[42m", 'LOCALCOLOR');
+$Term::ANSIColor::AUTOLOCAL = 1;
+is((BLUE 'text'), "\e[34mtext\e[31m\e[42m", 'AUTOLOCAL');
+is((BLUE 'te', 'xt'), "\e[34mtext\e[31m\e[42m", 'AUTOLOCAL with commas');
+$Term::ANSIColor::AUTOLOCAL = 0;
+is((POPCOLOR 'text'), "\e[0mtext", 'POPCOLOR with empty stack');
+
+# If AUTOLOCAL and AUTORESET are both set, the former takes precedence.
+is((PUSHCOLOR RED ON_GREEN 'text'),
+    "\e[31m\e[42mtext", 'Push some colors onto the stack');
+$Term::ANSIColor::AUTOLOCAL = 1;
+$Term::ANSIColor::AUTORESET = 1;
+is((BLUE 'text'), "\e[34mtext\e[31m\e[42m", 'AUTOLOCAL overrides AUTORESET');
+$Term::ANSIColor::AUTOLOCAL = 0;
+is((BLUE 'text'), "\e[34mtext\e[0m", 'AUTORESET works with stacked colors');
+is((POPCOLOR 'text'), "\e[0mtext\e[0m", 'POPCOLOR with empty stack');
+$Term::ANSIColor::AUTORESET = 0;
+
+# Test push and pop support with the syntax from the original openmethods.com
+# submission, which uses a different coding style.
+is(PUSHCOLOR(RED ON_GREEN), "\e[31m\e[42m", 'PUSHCOLOR with explict argument');
+is(PUSHCOLOR(BLUE), "\e[34m", '...and another explicit argument');
+is(
+    RESET . BLUE . 'text',
+    "\e[0m\e[34mtext",
+    '...and constants with concatenation'
+);
+is(
+    POPCOLOR . 'text',
+    "\e[31m\e[42mtext",
+    '...and POPCOLOR works without an argument'
+);
+is(
+    LOCALCOLOR(GREEN . ON_BLUE . 'text'),
+    "\e[32m\e[44mtext\e[31m\e[42m",
+    'LOCALCOLOR with two arguments'
+);
+is(POPCOLOR . 'text', "\e[0mtext", 'POPCOLOR with no arguments');
+
+# Prior to Term::ANSIColor, PUSHCOLOR, unlike all other constants, didn't take
+# an array, so it could lose colors in some syntax.
+is(PUSHCOLOR(RED, ON_GREEN), "\e[31m\e[42m", 'PUSHCOLOR with two arguments');
+is(
+    LOCALCOLOR(GREEN, 'text'),
+    "\e[32mtext\e[31m\e[42m",
+    'LOCALCOLOR with two arguments'
+);
+is(POPCOLOR(BOLD, 'text'), "\e[0m\e[1mtext", 'POPCOLOR with two arguments');
+
+# Test colorstrip.
+is(
+    colorstrip("\e[1mBold \e[31;42mon green\e[0m\e[m"),
+    'Bold on green',
+    'Basic color stripping'
+);
+is(colorstrip("\e[1m", 'bold', "\e[0m"),
+    'bold', 'Color stripping across multiple strings');
+is_deeply(
+    [colorstrip("\e[1m", 'bold', "\e[0m")],
+    [q{}, 'bold', q{}],
+    '...and in an array context'
+);
+is(colorstrip("foo\e[1m", 'bar', "baz\e[0m"),
+    'foobarbaz', '...and proper joining in scalar context');
+is(
+    colorstrip("\e[2cSome other code\e and stray [0m stuff"),
+    "\e[2cSome other code\e and stray [0m stuff",
+    'colorstrip does not remove non-color stuff'
+);
+
+# Test colorvalid.
+ok(
+    colorvalid('blue bold dark', 'blink on_green'),
+    'colorvalid returns true for valid attributes'
+);
+ok(!colorvalid('green orange'), '...and false for invalid attributes');
+
+# Test error handling in color.
+my $output = eval { color('chartreuse') };
+is($output, undef, 'color on unknown color name fails');
+like(
+    $@,
+    qr{ \A Invalid [ ] attribute [ ] name [ ] chartreuse [ ] at [ ] }xms,
+    '...with the right error'
+);
+
+# Test error handling in colored.
+$output = eval { colored('Stuff', 'chartreuse') };
+is($output, undef, 'colored on unknown color name fails');
+like(
+    $@,
+    qr{ \A Invalid [ ] attribute [ ] name [ ] chartreuse [ ] at [ ] }xms,
+    '...with the right error'
+);
+
+# Test error handling in uncolor.
+$output = eval { uncolor "\e[28m" };
+is($output, undef, 'uncolor on unknown color code fails');
+like(
+    $@,
+    qr{ \A No [ ] name [ ] for [ ] escape [ ] sequence [ ] 28 [ ] at [ ] }xms,
+    '...with the right error'
+);
+$output = eval { uncolor "\e[foom" };
+is($output, undef, 'uncolor on bad escape sequence fails');
+like(
+    $@,
+    qr{ \A Bad [ ] escape [ ] sequence [ ] foo [ ] at [ ] }xms,
+    '...with the right error'
+);
+
+# Test error reporting when calling unrecognized Term::ANSIColor subs that go
+# through AUTOLOAD.
+ok(!eval { Term::ANSIColor::RSET() }, 'Running invalid constant');
+like(
+    $@,
+    qr{ \A undefined [ ] subroutine [ ] \&Term::ANSIColor::RSET [ ] called
+        [ ] at [ ] }xms,
+    'Correct error from an attribute that is not defined'
+);
+ok(!eval { Term::ANSIColor::reset() }, 'Running invalid sub');
+like(
+    $@,
+    qr{ \A undefined [ ] subroutine [ ] \&Term::ANSIColor::reset [ ] called
+        [ ] at [ ] }xms,
+    'Correct error from a lowercase attribute'
+);
+
+# Ensure that we still get proper error reporting for unknown constants when
+# when colors are disabled.
+local $ENV{ANSI_COLORS_DISABLED} = 1;
+eval { Term::ANSIColor::RSET() };
+like(
+    $@,
+    qr{ \A undefined [ ] subroutine [ ] \&Term::ANSIColor::RSET [ ] called
+        [ ] at [ ] }xms,
+    'Correct error from undefined attribute with disabled colors'
+);
+delete $ENV{ANSI_COLORS_DISABLED};
+
+# These are somewhat redundant, but they ensure we test all the branches in
+# our generated constant subs so that we can use Test::Strict to check test
+# suite coverage.
+is((BOLD 't'),          "\e[1mt",   'Basic constant works for BOLD');
+is((BLUE 't'),          "\e[34mt",  '...and for BLUE');
+is((GREEN 't'),         "\e[32mt",  '...and for GREEN');
+is((DARK 't'),          "\e[2mt",   '...and for DARK');
+is((FAINT 't'),         "\e[2mt",   '...and for FAINT');
+is((BRIGHT_RED 't'),    "\e[91mt",  '...and for BRIGHT_RED');
+is((ON_BRIGHT_RED 't'), "\e[101mt", '...and for ON_BRIGHT_RED');
+is((ITALIC 't'),        "\e[3mt",   '...and for ITALIC');
+is((RED 't'),           "\e[31mt",  '...and for RED');
+is((ON_GREEN 't'),      "\e[42mt",  '...and for ON_GREEN');
+is((ON_BLUE 't'),       "\e[44mt",  '...and for ON_BLUE');
+is((RESET 't'),         "\e[0mt",   '...and for RESET');
+
+# Do the same for disabled colors.
+local $ENV{ANSI_COLORS_DISABLED} = 1;
+is(BOLD,          q{}, 'ANSI_COLORS_DISABLED works for BOLD');
+is(BLUE,          q{}, '...and for BLUE');
+is(GREEN,         q{}, '...and for GREEN');
+is(DARK,          q{}, '...and for DARK');
+is(FAINT,         q{}, '...and for FAINT');
+is(BRIGHT_RED,    q{}, '...and for BRIGHT_RED');
+is(ON_BRIGHT_RED, q{}, '...and for ON_BRIGHT_RED');
+is(ITALIC,        q{}, '...and for ITALIC');
+is(RED,           q{}, '...and for RED');
+is(ON_GREEN,      q{}, '...and for ON_GREEN');
+is(ON_BLUE,       q{}, '...and for ON_BLUE');
+is(RESET,         q{}, '...and for RESET');
+delete $ENV{ANSI_COLORS_DISABLED};
+
+# Do the same for AUTORESET.
+$Term::ANSIColor::AUTORESET = 1;
+is((BOLD 't'),          "\e[1mt\e[0m",   'AUTORESET works for BOLD');
+is((BLUE 't'),          "\e[34mt\e[0m",  '...and for BLUE');
+is((GREEN 't'),         "\e[32mt\e[0m",  '...and for GREEN');
+is((DARK 't'),          "\e[2mt\e[0m",   '...and for DARK');
+is((FAINT 't'),         "\e[2mt\e[0m",   '...and for FAINT');
+is((BRIGHT_RED 't'),    "\e[91mt\e[0m",  '...and for BRIGHT_RED');
+is((ON_BRIGHT_RED 't'), "\e[101mt\e[0m", '...and for ON_BRIGHT_RED');
+is((ITALIC 't'),        "\e[3mt\e[0m",   '...and for ITALIC');
+is((RED 't'),           "\e[31mt\e[0m",  '...and for RED');
+is((ON_GREEN 't'),      "\e[42mt\e[0m",  '...and for ON_GREEN');
+is((ON_BLUE 't'),       "\e[44mt\e[0m",  '...and for ON_BLUE');
+is((RESET 't'),         "\e[0mt\e[0m",   '...and for RESET');
+is((BOLD),              "\e[1m",         'AUTORESET without text for BOLD');
+is((BLUE),              "\e[34m",        '...and for BLUE');
+is((GREEN),             "\e[32m",        '...and for GREEN');
+is((DARK),              "\e[2m",         '...and for DARK');
+is((FAINT),             "\e[2m",         '...and for FAINT');
+is((BRIGHT_RED),        "\e[91m",        '...and for BRIGHT_RED');
+is((ON_BRIGHT_RED),     "\e[101m",       '...and for ON_BRIGHT_RED');
+is((ITALIC),            "\e[3m",         '...and for ITALIC');
+is((RED),               "\e[31m",        '...and for RED');
+is((ON_GREEN),          "\e[42m",        '...and for ON_GREEN');
+is((ON_BLUE),           "\e[44m",        '...and for ON_BLUE');
+is((RESET),             "\e[0m",         '...and for RESET');
+$Term::ANSIColor::AUTORESET = 0;
+
+# Do the same for AUTOLOCAL.
+$Term::ANSIColor::AUTOLOCAL = 1;
+is((BOLD 't'),          "\e[1mt\e[0m",   'AUTOLOCAL works for BOLD');
+is((BLUE 't'),          "\e[34mt\e[0m",  '...and for BLUE');
+is((GREEN 't'),         "\e[32mt\e[0m",  '...and for GREEN');
+is((DARK 't'),          "\e[2mt\e[0m",   '...and for DARK');
+is((FAINT 't'),         "\e[2mt\e[0m",   '...and for FAINT');
+is((BRIGHT_RED 't'),    "\e[91mt\e[0m",  '...and for BRIGHT_RED');
+is((ON_BRIGHT_RED 't'), "\e[101mt\e[0m", '...and for ON_BRIGHT_RED');
+is((ITALIC 't'),        "\e[3mt\e[0m",   '...and for ITALIC');
+is((RED 't'),           "\e[31mt\e[0m",  '...and for RED');
+is((ON_GREEN 't'),      "\e[42mt\e[0m",  '...and for ON_GREEN');
+is((ON_BLUE 't'),       "\e[44mt\e[0m",  '...and for ON_BLUE');
+is((RESET 't'),         "\e[0mt\e[0m",   '...and for RESET');
+is((BOLD),              "\e[1m",         'AUTOLOCAL without text for BOLD');
+is((BLUE),              "\e[34m",        '...and for BLUE');
+is((GREEN),             "\e[32m",        '...and for GREEN');
+is((DARK),              "\e[2m",         '...and for DARK');
+is((FAINT),             "\e[2m",         '...and for FAINT');
+is((BRIGHT_RED),        "\e[91m",        '...and for BRIGHT_RED');
+is((ON_BRIGHT_RED),     "\e[101m",       '...and for ON_BRIGHT_RED');
+is((ITALIC),            "\e[3m",         '...and for ITALIC');
+is((RED),               "\e[31m",        '...and for RED');
+is((ON_GREEN),          "\e[42m",        '...and for ON_GREEN');
+is((ON_BLUE),           "\e[44m",        '...and for ON_BLUE');
+is((RESET),             "\e[0m",         '...and for RESET');
+$Term::ANSIColor::AUTOLOCAL = 0;
+
+# Force an internal error inside the AUTOLOAD stub by creating an attribute
+# that will generate a syntax error.  This is just for coverage purposes.
+# Disable warnings since our syntax error will spew otherwise.
+local $SIG{__WARN__} = sub { };
+$Term::ANSIColor::ATTRIBUTES{yellow} = q{'ERROR'};
+ok(!eval { YELLOW 't' }, 'Caught internal AUTOLOAD error');
+like(
+    $@,
+    qr{ \A failed [ ] to [ ] generate [ ] constant [ ] YELLOW: [ ] }xms,
+    '...with correct error message'
+);
@@ -0,0 +1,129 @@
+#!/usr/bin/perl
+#
+# Tests for 256-color support.
+#
+# Copyright 2012 Kurt Starsinic <kstarsinic@gmail.com>
+# Copyright 2012, 2013 Russ Allbery <rra@cpan.org>
+#
+# This program is free software; you may redistribute it and/or modify it
+# under the same terms as Perl itself.
+
+use strict;
+use warnings;
+
+use Test::More tests => 92;
+
+# Load the module.
+BEGIN {
+    delete $ENV{ANSI_COLORS_ALIASES};
+    delete $ENV{ANSI_COLORS_DISABLED};
+    use_ok('Term::ANSIColor', qw(:constants256 color uncolor colorvalid));
+}
+
+# Test basic 256-color codes.
+is(color('ansi0'),  "\e[38;5;0m",   'ANSI 0');
+is(color('ansi15'), "\e[38;5;15m",  'ANSI 15');
+is(color('rgb000'), "\e[38;5;16m",  'RGB 000');
+is(color('rgb555'), "\e[38;5;231m", 'RGB 555');
+is(color('grey0'),  "\e[38;5;232m", 'Grey 0');
+is(color('grey23'), "\e[38;5;255m", 'Grey 23');
+
+# Errors at boundary cases.
+for my $color (qw(ansi16 rgb600 rgb060 rgb006 rgb666 rgb999 rgb0000 grey24)) {
+    my $output = eval { color($color) };
+    is($output, undef, 'color on unknown color name fails');
+    like(
+        $@,
+        qr{ \A Invalid [ ] attribute [ ] name [ ] \Q$color\E [ ] at [ ] }xms,
+        '...with the right error'
+    );
+    ok(!colorvalid($color), '...and colorvalid says it is invalid');
+}
+
+# Check that various 256-color codes are valid.
+for my $color (qw(ansi0 ansi15 rgb000 rgb555 grey0 grey23)) {
+    ok(colorvalid($color), "Color $color is valid");
+}
+
+# Check uncolor with 256-color codes.
+is_deeply([uncolor('38;5;0')],        ['ansi0'],    'uncolor of ansi0');
+is_deeply([uncolor("\e[38;5;231m")],  ['rgb555'],   'uncolor of rgb555');
+is_deeply([uncolor("\e[48;05;001m")], ['on_ansi1'], 'uncolor with leading 0s');
+
+# An invalid 256-color code should report an error on the part that makes it
+# invalid.  Check truncated codes (should report on the 38 or 48), codes with
+# an invalid second part (likewise), and codes with an invalid third part
+# (should report the complete code).
+#
+# This is a hash of test escape sequences to the invalid sequence that should
+# be reported.
+my %uncolor_tests = (
+    "\e[38m"       => 38,
+    "\e[38;5m"     => 38,
+    "\e[38;5;256m" => '38;5;256',
+    "\e[38;5;777m" => '38;5;777',
+    "\e[48m"       => 48,
+    "\e[48;5m"     => 48,
+    "\e[48;5;256m" => '48;5;256',
+    "\e[48;5;777m" => '48;5;777',
+);
+while (my ($escape, $invalid) = each %uncolor_tests) {
+    my $output = eval { uncolor($escape) };
+    is($output, undef, "uncolor on unknown color code \Q$escape\E fails");
+    like(
+        $@,
+        qr{ \A No [ ] name [ ] for [ ] escape [ ] sequence [ ] \Q$invalid\E
+            [ ] at [ ] }xms,
+        '...with the right error'
+    );
+}
+
+# Test all the variations of a few different constants.
+is((ANSI0 't'),  "\e[38;5;0mt",   'Basic constant works for ANSI0');
+is((ANSI15 't'), "\e[38;5;15mt",  '...and for ANSI15');
+is((RGB000 't'), "\e[38;5;16mt",  '...and for RGB000');
+is((RGB555 't'), "\e[38;5;231mt", '...and for RGB555');
+is((GREY0 't'),  "\e[38;5;232mt", '...and for GREY0');
+is((GREY23 't'), "\e[38;5;255mt", '...and for GREY23');
+
+# Do the same for disabled colors.
+local $ENV{ANSI_COLORS_DISABLED} = 1;
+is(ANSI0,  q{}, 'ANSI_COLORS_DISABLED works for ANSI0');
+is(ANSI15, q{}, '...and for ANSI15');
+is(RGB000, q{}, '...and for RGB000');
+is(RGB555, q{}, '...and for RGB555');
+is(GREY0,  q{}, '...and for GREY0');
+is(GREY23, q{}, '...and for GREY23');
+delete $ENV{ANSI_COLORS_DISABLED};
+
+# Do the same for AUTORESET.
+$Term::ANSIColor::AUTORESET = 1;
+is((ANSI0 't'),  "\e[38;5;0mt\e[0m",   'AUTORESET works for ANSI0');
+is((ANSI15 't'), "\e[38;5;15mt\e[0m",  '...and for ANSI15');
+is((RGB000 't'), "\e[38;5;16mt\e[0m",  '...and for RGB000');
+is((RGB555 't'), "\e[38;5;231mt\e[0m", '...and for RGB555');
+is((GREY0 't'),  "\e[38;5;232mt\e[0m", '...and for GREY0');
+is((GREY23 't'), "\e[38;5;255mt\e[0m", '...and for GREY23');
+is((ANSI0),      "\e[38;5;0m",         'AUTORESET without text for ANSI0');
+is((ANSI15),     "\e[38;5;15m",        '...and for ANSI15');
+is((RGB000),     "\e[38;5;16m",        '...and for RGB000');
+is((RGB555),     "\e[38;5;231m",       '...and for RGB555');
+is((GREY0),      "\e[38;5;232m",       '...and for GREY0');
+is((GREY23),     "\e[38;5;255m",       '...and for GREY23');
+$Term::ANSIColor::AUTORESET = 0;
+
+# Do the same for AUTOLOCAL.
+$Term::ANSIColor::AUTOLOCAL = 1;
+is((ANSI0 't'),  "\e[38;5;0mt\e[0m",   'AUTOLOCAL works for ANSI0');
+is((ANSI15 't'), "\e[38;5;15mt\e[0m",  '...and for ANSI15');
+is((RGB000 't'), "\e[38;5;16mt\e[0m",  '...and for RGB000');
+is((RGB555 't'), "\e[38;5;231mt\e[0m", '...and for RGB555');
+is((GREY0 't'),  "\e[38;5;232mt\e[0m", '...and for GREY0');
+is((GREY23 't'), "\e[38;5;255mt\e[0m", '...and for GREY23');
+is((ANSI0),      "\e[38;5;0m",         'AUTOLOCAL without text for ANSI0');
+is((ANSI15),     "\e[38;5;15m",        '...and for ANSI15');
+is((RGB000),     "\e[38;5;16m",        '...and for RGB000');
+is((RGB555),     "\e[38;5;231m",       '...and for RGB555');
+is((GREY0),      "\e[38;5;232m",       '...and for GREY0');
+is((GREY23),     "\e[38;5;255m",       '...and for GREY23');
+$Term::ANSIColor::AUTOLOCAL = 0;
@@ -0,0 +1,60 @@
+#!/usr/bin/perl
+#
+# Test suite for $@ preservation with constants.
+#
+# Earlier versions of Term::ANSIColor would clobber $@ during AUTOLOAD
+# processing and lose its value or leak $@ values to the calling program.
+# This is a regression test to ensure that this problem doesn't return.
+#
+# Copyright 2012, 2013, 2014 Russ Allbery <rra@cpan.org>
+#
+# This program is free software; you may redistribute it and/or modify it
+# under the same terms as Perl itself.
+
+use strict;
+use warnings;
+
+use Test::More tests => 15;
+
+# We refer to $@ in the test descriptions.
+## no critic (ValuesAndExpressions::RequireInterpolationOfMetachars)
+
+# Load the module.
+BEGIN {
+    delete $ENV{ANSI_COLORS_ALIASES};
+    delete $ENV{ANSI_COLORS_DISABLED};
+    use_ok('Term::ANSIColor', qw(:constants));
+}
+
+# Ensure that using a constant doesn't leak anything in $@.
+is((BOLD 'test'), "\e[1mtest", 'BOLD works');
+is($@,            q{},         '... and $@ is empty');
+
+# Store something in $@ and ensure it doesn't get clobbered.
+## no critic (BuiltinFunctions::ProhibitStringyEval)
+eval 'sub { syntax';
+is((BLINK 'test'), "\e[5mtest", 'BLINK works after eval failure');
+isnt($@, q{}, '... and $@ still contains something useful');
+
+# Do some additional unnecessary testing so that coverage analysis works
+# properly.  First, check disabled colors.
+local $ENV{ANSI_COLORS_DISABLED} = 1;
+is(BOLD,  q{}, 'ANSI_COLORS_DISABLED works for BOLD');
+is(BLINK, q{}, '...and for BLINK');
+delete $ENV{ANSI_COLORS_DISABLED};
+
+# Now, AUTORESET.
+$Term::ANSIColor::AUTORESET = 1;
+is((BOLD 't'),  "\e[1mt\e[0m", 'AUTORESET works for BOLD');
+is((BLINK 't'), "\e[5mt\e[0m", '...and for BLINK');
+is((BOLD),      "\e[1m",       'AUTORESET without text for BOLD');
+is((BLINK),     "\e[5m",       '...and for BLINK');
+$Term::ANSIColor::AUTORESET = 0;
+
+# And, finally, AUTOLOCAL.
+$Term::ANSIColor::AUTOLOCAL = 1;
+is((BOLD 't'),  "\e[1mt\e[0m", 'AUTOLOCAL works for BOLD');
+is((BLINK 't'), "\e[5mt\e[0m", '...and for BLINK');
+is((BOLD),      "\e[1m",       'AUTOLOCAL without text for BOLD');
+is((BLINK),     "\e[5m",       '...and for BLINK');
+$Term::ANSIColor::AUTOLOCAL = 0;
@@ -0,0 +1,54 @@
+#!/usr/bin/perl
+#
+# Test suite for stringify interaction.
+#
+# Copyright 2011 Revilo Reegiles
+# Copyright 2011, 2014 Russ Allbery <rra@cpan.org>
+#
+# This program is free software; you may redistribute it and/or modify it
+# under the same terms as Perl itself.
+
+use strict;
+use warnings;
+
+use Test::More tests => 6;
+
+# Create a dummy class that implements stringification.
+## no critic (Modules::ProhibitMultiplePackages)
+package Test::Stringify;
+use overload '""' => 'stringify';
+sub new { return bless({}, 'Test::Stringify') }
+sub stringify { return "Foo Bar\n" }
+
+# Back to the main package.
+package main;
+
+# Load the module.
+BEGIN {
+    delete $ENV{ANSI_COLORS_ALIASES};
+    delete $ENV{ANSI_COLORS_DISABLED};
+    use_ok('Term::ANSIColor', qw(colored));
+}
+
+# Some basic tests of colored without stringification.
+my $result = colored(['blue', 'bold'], 'testing');
+is($result, "\e[34;1mtesting\e[0m", 'colored with an array reference');
+$result = colored("ok\n", 'bold blue');
+is($result, "\e[1;34mok\n\e[0m", 'colored with a following string');
+
+# Create a stringifiable object and repeat the tests.
+my $test = Test::Stringify->new;
+$result = colored($test . q{}, 'bold blue');
+is($result, "\e[1;34mFoo Bar\n\e[0m", 'colored with forced stringification');
+$result = colored($test, 'bold blue');
+is($result, "\e[1;34mFoo Bar\n\e[0m", 'colored with a non-array reference');
+
+# Create a hash reference and try stringifying it.
+## no critic (RegularExpressions::ProhibitEscapedMetacharacters)
+my %foo = (foo => 'bar');
+$result = colored(\%foo, 'bold blue');
+like(
+    $result,
+    qr{ \e\[1;34m HASH\(.*\) \e\[0m }xms,
+    'colored with a hash reference'
+);
@@ -1,75 +0,0 @@
-#!/usr/bin/perl
-#
-# t/pod-spelling.t -- Test POD spelling.
-#
-# Checks all POD files in the tree for spelling problems using Pod::Spell and
-# either aspell or ispell.  aspell is preferred.  This test is disabled unless
-# RRA_MAINTAINER_TESTS is set, since spelling dictionaries vary too much
-# between environments.
-#
-# Copyright 2008, 2009 Russ Allbery <rra@stanford.edu>
-#
-# This program is free software; you may redistribute it and/or modify it
-# under the same terms as Perl itself.
-
-use strict;
-use Test::More;
-
-# Skip all spelling tests unless the maintainer environment variable is set.
-plan skip_all => 'Spelling tests only run for maintainer'
-    unless $ENV{RRA_MAINTAINER_TESTS};
-
-# Load required Perl modules.
-eval 'use Test::Pod 1.00';
-plan skip_all => 'Test::Pod 1.00 required for testing POD' if $@;
-eval 'use Pod::Spell';
-plan skip_all => 'Pod::Spell required to test POD spelling' if $@;
-
-# Locate a spell-checker.  hunspell is not currently supported due to its lack
-# of support for contractions (at least in the version in Debian).
-my @spell;
-my %options = (aspell => [ qw(-d en_US --home-dir=./ list) ],
-               ispell => [ qw(-d american -l -p /dev/null) ]);
-SEARCH: for my $program (qw/aspell ispell/) {
-    for my $dir (split ':', $ENV{PATH}) {
-        if (-x "$dir/$program") {
-            @spell = ("$dir/$program", @{ $options{$program} });
-        }
-        last SEARCH if @spell;
-    }
-}
-plan skip_all => 'aspell or ispell required to test POD spelling'
-    unless @spell;
-
-# Prerequisites are satisfied, so we're going to do some testing.  Figure out
-# what POD files we have and from that develop our plan.
-$| = 1;
-my @pod = all_pod_files ();
-plan tests => scalar @pod;
-
-# Finally, do the checks.
-for my $pod (@pod) {
-    my $child = open (CHILD, '-|');
-    if (not defined $child) {
-        die "Cannot fork: $!\n";
-    } elsif ($child == 0) {
-        my $pid = open (SPELL, '|-', @spell) or die "Cannot run @spell: $!\n";
-        open (POD, '<', $pod) or die "Cannot open $pod: $!\n";
-        my $parser = Pod::Spell->new;
-        $parser->parse_from_filehandle (\*POD, \*SPELL);
-        close POD;
-        close SPELL;
-        exit ($? >> 8);
-    } else {
-        my @words = <CHILD>;
-        close CHILD;
-      SKIP: {
-            skip "@spell failed for $pod", 1 unless $? == 0;
-            for (@words) {
-                s/^\s+//;
-                s/\s+$//;
-            }
-            is ("@words", '', $pod);
-        }
-    }
-}
@@ -1,11 +0,0 @@
-#!/usr/bin/perl
-#
-# t/pod.t -- Test POD formatting for Term::ANSIColor.
-#
-# Taken essentially verbatim from the examples in the Test::Pod documentation.
-
-use strict;
-use Test::More;
-eval 'use Test::Pod 1.00';
-plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
-all_pod_files_ok ();
@@ -1,38 +0,0 @@
-#!/usr/bin/perl -Tw
-#
-# t/stringify.t -- Test suite for stringify interaction.
-#
-# Copyright 2011 Revilo Reegiles
-# Copyright 2011 Russ Allbery <rra@stanford.edu>
-#
-# This program is free software; you may redistribute it and/or modify it
-# under the same terms as Perl itself.
-
-# Create a dummy class that implements stringification.
-package Test::Stringify;
-use overload '""' => 'stringify';
-sub new { return bless {} }
-sub stringify { return "Foo Bar\n" }
-package main;
-
-use strict;
-use Test::More tests => 6;
-
-BEGIN {
-    delete $ENV{ANSI_COLORS_DISABLED};
-    use_ok ('Term::ANSIColor',
-            qw/:pushpop color colored uncolor colorstrip colorvalid/);
-}
-
-is (colored ([ 'blue', 'bold' ], 'testing'), "\e[34;1mtesting\e[0m",
-    'colored with an array reference');
-is (colored ("ok\n", 'bold blue'), "\e[1;34mok\n\e[0m",
-    'colored with a following string');
-my $test = Test::Stringify->new;
-is (colored ($test . "", 'bold blue'), "\e[1;34mFoo Bar\n\e[0m",
-    'colored with forced stringification');
-is (colored ($test, 'bold blue'), "\e[1;34mFoo Bar\n\e[0m",
-    'colored with a non-array reference');
-my %foo = (foo => 'bar');
-like (colored (\%foo, 'bold blue'), qr/\e\[1;34mHASH\(.*\)\e\[0m/,
-      'colored with a hash reference');
@@ -0,0 +1,71 @@
+#!/usr/bin/perl
+#
+# Test Perl code for test coverage.
+#
+# The canonical version of this file is maintained in the rra-c-util package,
+# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2013, 2014
+#     The Board of Trustees of the Leland Stanford Junior University
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+use 5.006;
+use strict;
+use warnings;
+
+use lib 't/lib';
+
+use File::Spec;
+use Test::More;
+use Test::RRA qw(skip_unless_author use_prereq);
+use Test::RRA::Config qw($COVERAGE_LEVEL @COVERAGE_SKIP_TESTS);
+
+# Skip code coverage unless author tests are enabled since it takes a long
+# time, is sensitive to versions of various libraries, and does not detect
+# functionality problems.
+skip_unless_author('Coverage tests');
+
+# Load prerequisite modules.
+use_prereq('Devel::Cover');
+use_prereq('Test::Strict');
+
+# Build a list of test directories to use for coverage.
+my %ignore = map { $_ => 1 } qw(data docs style), @COVERAGE_SKIP_TESTS;
+opendir(my $testdir, 't') or BAIL_OUT("cannot open t: $!");
+my @t_dirs = readdir($testdir) or BAIL_OUT("cannot read t: $!");
+closedir($testdir) or BAIL_OUT("cannot close t: $!");
+
+# Filter out ignored and system directories.
+@t_dirs = grep { !$ignore{$_} } File::Spec->no_upwards(@t_dirs);
+
+# Prepend the t directory name to the directories.
+@t_dirs = map { File::Spec->catfile('t', $_) } @t_dirs;
+
+# Disable POD coverage; that's handled separately and is confused by
+# autoloading.
+$Test::Strict::DEVEL_COVER_OPTIONS
+  = '-coverage,statement,branch,condition,subroutine';
+
+# Do the coverage analysis.
+all_cover_ok($COVERAGE_LEVEL, @t_dirs);
+
+# Hack to suppress "used only once" warnings.
+END { $Test::Strict::DEVEL_COVER_OPTIONS = q{} }
@@ -0,0 +1,87 @@
+#!/usr/bin/perl
+#
+# Check for perlcritic errors in all code.
+#
+# If author tests are enabled, check all Perl code in blib/lib, examples, usr,
+# t, and Build.PL for problems uncovered by perlcritic, ignoring template
+# files, junk, and any files explicitly configured to be ignored.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2013, 2014
+#     The Board of Trustees of the Leland Stanford Junior University
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+use 5.006;
+use strict;
+use warnings;
+
+use lib 't/lib';
+
+use Test::More;
+use Test::RRA qw(skip_unless_author use_prereq);
+use Test::RRA::Config qw(@CRITIC_IGNORE);
+
+# Skip tests unless we're running author tests since this test is too
+# sensitive to the exact version of Perl::Critic to be generally useful.
+skip_unless_author('Coding style tests');
+
+# Load prerequisite modules.
+use_prereq('Perl::Critic::Utils');
+use_prereq('Test::Perl::Critic');
+
+# Force the embedded Perl::Tidy check to use the correct configuration.
+local $ENV{PERLTIDY} = 't/data/perltidyrc';
+
+# Import the configuration file and run Perl::Critic.
+Test::Perl::Critic->import(-profile => 't/data/perlcriticrc');
+
+# By default, Test::Perl::Critic only checks blib.  We also want to check t,
+# Build.PL, and examples.
+my @files = Perl::Critic::Utils::all_perl_files('blib');
+if (!@files) {
+    @files = Perl::Critic::Utils::all_perl_files('lib');
+}
+if (-f 'Build.PL') {
+    push(@files, 'Build.PL');
+}
+for my $dir (qw(examples usr t)) {
+    if (-d $dir) {
+        push(@files, Perl::Critic::Utils::all_perl_files($dir));
+    }
+}
+
+# Strip out Autoconf templates or left-over perltidy files.
+@files = grep { !m{ [.](?:in|tdy) }xms } @files;
+
+# Strip out ignored files.
+my %ignore = map { $_ => 1 } @CRITIC_IGNORE;
+@files = grep { !$ignore{$_} } @files;
+
+# Declare a plan now that we know what we're testing.
+plan tests => scalar @files;
+
+# Run the actual tests.
+for my $file (@files) {
+    critic_ok($file);
+}
+
+# On Debian with perltidy 20130922-1, a perltidy.LOG file gets left behind in
+# the current directory.  Remove it if it exists.
+unlink('perltidy.LOG');
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+#
+# Check that too-new features of Perl are not being used.
+#
+# The canonical version of this file is maintained in the rra-c-util package,
+# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2013, 2014
+#     The Board of Trustees of the Leland Stanford Junior University
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+use 5.006;
+use strict;
+use warnings;
+
+use lib 't/lib';
+
+use Test::More;
+use Test::RRA qw(skip_unless_automated use_prereq);
+use Test::RRA::Config qw($MINIMUM_VERSION);
+
+# Skip for normal user installs since this doesn't affect functionality.
+skip_unless_automated('Minimum version tests');
+
+# Load prerequisite modules.
+use_prereq('Test::MinimumVersion');
+
+# Check all files in the Perl distribution.
+all_minimum_version_ok($MINIMUM_VERSION);
@@ -0,0 +1,56 @@
+#!/usr/bin/perl
+#
+# Test Perl code for strict, warnings, and syntax.
+#
+# The canonical version of this file is maintained in the rra-c-util package,
+# which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2013, 2014
+#     The Board of Trustees of the Leland Stanford Junior University
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+use 5.006;
+use strict;
+use warnings;
+
+use lib 't/lib';
+
+use File::Spec;
+use Test::RRA qw(skip_unless_automated use_prereq);
+
+# Skip for normal user installs since this doesn't affect functionality.
+skip_unless_automated('Strictness tests');
+
+# Load prerequisite modules.
+use_prereq('Test::Strict');
+
+# Test everything in the distribution directory except the Build and
+# Makefile.PL scripts generated by Module::Build.  We also want to check use
+# warnings.
+$Test::Strict::TEST_SKIP = ['Build', 'Makefile.PL'];
+$Test::Strict::TEST_WARNINGS = 1;
+all_perl_files_ok(File::Spec->curdir);
+
+# Hack to suppress "used only once" warnings.
+END {
+    $Test::Strict::TEST_SKIP     = [];
+    $Test::Strict::TEST_WARNINGS = 0;
+}
@@ -0,0 +1,39 @@
+#!/usr/bin/perl -T
+#
+# Check that Term::ANSIColor untaints generated constants.
+#
+# It's possible that the name of the constant function that we're calling
+# could be tained (such as by loading the name of the constant function from
+# an environment variable).  Term::ANSIColor does the work to untaint it; be
+# sure that the taint flag is properly cleared.
+#
+# Copyright 2012 Russ Allbery <rra@cpan.org>
+#
+# This program is free software; you may redistribute it and/or modify it
+# under the same terms as Perl itself.
+
+use strict;
+use warnings;
+
+use Test::More tests => 4;
+
+# Load the module.
+BEGIN {
+    delete $ENV{ANSI_COLORS_ALIASES};
+    delete $ENV{ANSI_COLORS_DISABLED};
+    use_ok('Term::ANSIColor', qw(:pushpop));
+}
+
+# Generate a tainted constant name.  PATH is always tainted, and tainting is
+# sticky, so we can prepend the name to whatever PATH holds and then chop it
+# off again.
+my $constant = substr 'BOLD' . $ENV{PATH}, 0, length 'BOLD';
+
+# Using that as a constant should now work without any tainting problems.
+## no critic (TestingAndDebugging::ProhibitNoStrict)
+{
+    no strict 'refs';
+    is(&{$constant}(), "\e[1m", 'Constant subs are not tainted');
+    is(BOLD(),         "\e[1m", '...and we can call the sub again');
+    ok(defined(&Term::ANSIColor::BOLD), '...and it is now defined');
+}
@@ -1,8 +0,0 @@
-The files in this directory were written by Joe Smith to test terminals
-for support of various VT100 escape sequences.  ansicolor is of the most
-interest in developing this package, but vt100-torture also tests some of
-the other attributes this module supports.
-
-To use one of these files, you should be able to display it in your
-terminal with cat.  These tests may be useful in expanding the table of
-supported terminal emulators in the Term::ANSIColor documentation.
@@ -1,17 +0,0 @@
-ANSI Colors         $[30m $[31m $[32m  $[33m   $[34m $[35m   $[36m $[37m
-     $[40m=black    black  red  green  yellow  blue  magenta cyan  white 
-bold $[40m=black    black  red  green  yellow  blue  magenta cyan  white 
-     $[41m=red      black  red  green  yellow  blue  magenta cyan  white 
-bold $[41m=red      black  red  green  yellow  blue  magenta cyan  white 
-     $[42m=green    black  red  green  yellow  blue  magenta cyan  white 
-bold $[42m=green    black  red  green  yellow  blue  magenta cyan  white 
-     $[43m=yellow   black  red  green  yellow  blue  magenta cyan  white 
-bold $[43m=yellow   black  red  green  yellow  blue  magenta cyan  white 
-     $[44m=blue     black  red  green  yellow  blue  magenta cyan  white 
-bold $[44m=blue     black  red  green  yellow  blue  magenta cyan  white 
-     $[45m=magenta  black  red  green  yellow  blue  magenta cyan  white 
-bold $[45m=magenta  black  red  green  yellow  blue  magenta cyan  white 
-     $[46m=cyan     black  red  green  yellow  blue  magenta cyan  white 
-bold $[46m=cyan     black  red  green  yellow  blue  magenta cyan  white 
-     $[47m=white    black  red  green  yellow  blue  magenta cyan  white 
-bold $[47m=white    black  red  green  yellow  blue  magenta cyan  white 
@@ -1,60 +0,0 @@
-\<>PrEM1\[?4h
-#6(0a`opqrs`(B      This is the       (0`srqpo`a(B
-#3VT100 series Torture Test Demonstration.
-#4VT100 series Torture Test Demonstration.
-#6       Watch the blinking lights        
-
-
-
-PrEM0\
-
-This file is a VT100-series Torture Test.  It demonstrates all the visual
-attributes of the VT100 terminal.
-
-The top line is double-width/single-height with inverse-video line-drawing
-characters.  The 2nd and 3rd lines are double-width/double-height in bold
-inverse video.  They also show the limited scrolling region.
-
-The remaining lines will show NORMAL, BOLD, BLINK, INVERSE, and all 16
-combinations of those 4 attributes.  They show that there is a difference
-between an underscore character and the underline attribute, and that
-lower-case decenders go below the underline.
-
-A window pane is drawn in the lower right to show how the line-drawing set
-can be used.  At the lower left is the character set double-wide/double-high
-to show the dot-matrix used.  Upper-case characters are 8 by 7 in a 10 by 10
-character cell, with 1 blank row on top and 2 on the bottom.  The underline
-attribute uses the first bottom blank row, lower-case decenders use both.
-
-
-
-This is a normal line __________________________________________________y_
-This is a bold line (normal unless the Advanced Video Option is installed)
-This line is underlined _ "       "       "       "       "       "    _y_
-This is a blinking line _ "       "       "       "       "       "    _y_
-This is inverse video _ (underlined if no AVO and cursor is underline) _y_
-Normal gjpqy Underline   Blink   Underline+Blink gjpqy
-Bold   gjpqy Underline   Blink   Underline+Blink gjpqy
-Inverse      Underline   Blink   Underline+Blink
-Bold+Inverse Underline   Blink   Underline+Blink
-PrEM1\
-#6This is double width
-#3This is double height
-#4This is double height
-#6_ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ioy
-#3_ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ioy
-#4_ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ioy
-ACEGIKMOQSUWY02468iy
-_BDFHJLNPRTVXZ13579o
-_BDFHJLNPRTVXZ13579o
-(0#6`abcdefghijklmnopqrstuvwxyz{|}~ lqwqk
-#3`abcdefghijklmnopqrstuvwxyz{|}~ tqnqu
-#4`abcdefghijklmnopqrstuvwxyz{|}~ tqnqu
-acegikmoqsuwy{}
-`bdfhjlnprtvxz|~
-`bdfhjlnprtvxz|~(B
-#6`abcdefghijklmnopqrstuvwxyz{|}~(0 mqvqj(B
-acegikmoqsuwy{}
-PrEM0\ $PrEM0 works on GIGI 
-   This test created by Joe Smith, 8-May-85   
-