summaryrefslogtreecommitdiff
path: root/cpan/Term-ANSIColor
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2012-06-08 13:35:48 +0100
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2012-06-17 21:26:49 +0100
commit00196a0f55bccafee6bca6cef2d3432c4b6e176c (patch)
tree85b65b62552fca1285bc1da1b02a8630200ea1d5 /cpan/Term-ANSIColor
parent0a3486ef812a93f038026dfc56e6d542650df235 (diff)
downloadperl-00196a0f55bccafee6bca6cef2d3432c4b6e176c.tar.gz
Updated Term-ANSIColor to CPAN version 3.02
[DELTA] 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.
Diffstat (limited to 'cpan/Term-ANSIColor')
-rw-r--r--cpan/Term-ANSIColor/ANSIColor.pm63
-rw-r--r--cpan/Term-ANSIColor/ChangeLog23
-rw-r--r--cpan/Term-ANSIColor/README29
-rw-r--r--cpan/Term-ANSIColor/t/basic.t16
-rw-r--r--cpan/Term-ANSIColor/t/eval.t25
5 files changed, 121 insertions, 35 deletions
diff --git a/cpan/Term-ANSIColor/ANSIColor.pm b/cpan/Term-ANSIColor/ANSIColor.pm
index bc2fc7e483..9e3530ed42 100644
--- a/cpan/Term-ANSIColor/ANSIColor.pm
+++ b/cpan/Term-ANSIColor/ANSIColor.pm
@@ -1,7 +1,7 @@
# Term::ANSIColor -- Color screen output using ANSI escape sequences.
#
# Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2005, 2006, 2008, 2009, 2010,
-# 2011 Russ Allbery <rra@stanford.edu> and Zenin
+# 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
@@ -17,7 +17,7 @@
package Term::ANSIColor;
require 5.001;
-$VERSION = '3.01';
+$VERSION = '3.02';
use strict;
use vars qw($AUTOLOAD $AUTOLOCAL $AUTORESET @COLORLIST @COLORSTACK $EACHLINE
@@ -28,8 +28,8 @@ use Exporter ();
BEGIN {
@COLORLIST = qw(
CLEAR RESET BOLD DARK
- FAINT UNDERLINE UNDERSCORE BLINK
- REVERSE CONCEALED
+ FAINT ITALIC UNDERLINE UNDERSCORE
+ BLINK REVERSE CONCEALED
BLACK RED GREEN YELLOW
BLUE MAGENTA CYAN WHITE
@@ -59,6 +59,7 @@ BEGIN {
'bold' => 1,
'dark' => 2,
'faint' => 2,
+ 'italic' => 3,
'underline' => 4,
'underscore' => 4,
'blink' => 5,
@@ -116,12 +117,13 @@ for (reverse sort keys %ATTRIBUTES) {
# write scripts that also work on systems without any ANSI support, like
# Windows consoles.
sub AUTOLOAD {
- if (defined $ENV{ANSI_COLORS_DISABLED}) {
- return join ('', @_);
- }
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 && \@_) {
@@ -133,6 +135,8 @@ sub AUTOLOAD {
}
}
};
+ die "failed to generate constant $1" if $@;
+ $@ = $saved;
goto &$AUTOLOAD;
} else {
require Carp;
@@ -284,7 +288,7 @@ Term::ANSIColor - Color screen output using ANSI escape sequences
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
+grey ATTR urxvt mistyped
=head1 SYNOPSIS
@@ -388,14 +392,16 @@ Term::ANSIColor 3.0.
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, underline, underscore, blink,
+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, blink,
-and concealed in particular are frequently not implemented.
+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:
@@ -483,8 +489,8 @@ Alternately, if you import C<:constants>, you can use the following
constants directly:
CLEAR RESET BOLD DARK
- FAINT UNDERLINE UNDERSCORE BLINK
- REVERSE CONCEALED
+ FAINT ITALIC UNDERLINE UNDERSCORE
+ BLINK REVERSE CONCEALED
BLACK RED GREEN YELLOW
BLUE MAGENTA CYAN WHITE
@@ -508,6 +514,8 @@ to
(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
@@ -693,14 +701,19 @@ 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.
-Note that codes 3 (italic), 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.
+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
@@ -724,10 +737,10 @@ 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 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.
+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.
diff --git a/cpan/Term-ANSIColor/ChangeLog b/cpan/Term-ANSIColor/ChangeLog
index 77de255cd2..9706b2f3a8 100644
--- a/cpan/Term-ANSIColor/ChangeLog
+++ b/cpan/Term-ANSIColor/ChangeLog
@@ -1,3 +1,26 @@
+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.
diff --git a/cpan/Term-ANSIColor/README b/cpan/Term-ANSIColor/README
index 051c7c37e4..cd2d1fb5b6 100644
--- a/cpan/Term-ANSIColor/README
+++ b/cpan/Term-ANSIColor/README
@@ -1,15 +1,16 @@
- Term::ANSIColor version 3.01
+ Term::ANSIColor version 3.02
(A simple ANSI text attribute control module)
Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2005, 2006, 2007, 2009,
- 2010, 2011 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.
+ 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.
- 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.
+ 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.
BLURB
@@ -100,6 +101,12 @@ 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.
+
THANKS
To Jon Lennox for looking at early versions of this module, providing
@@ -159,4 +166,10 @@ THANKS
non-array references with stringification defined, and providing a test
case.
+ To Kent Fredric for the request for italic and the report of a terminal
+ emulator that supports it.
+
+ To Simon Wistow for reporting that Term::ANSIColor was inadvertantly
+ clobbering $@ when generating constant subs.
+
To Larry Wall, as always, for Perl.
diff --git a/cpan/Term-ANSIColor/t/basic.t b/cpan/Term-ANSIColor/t/basic.t
index c6fed3e54c..7f6bfffd9f 100644
--- a/cpan/Term-ANSIColor/t/basic.t
+++ b/cpan/Term-ANSIColor/t/basic.t
@@ -2,14 +2,14 @@
#
# t/basic.t -- Test suite for the Term::ANSIColor Perl module.
#
-# Copyright 1997, 1998, 2000, 2001, 2002, 2005, 2006, 2009, 2010
+# 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 => 51;
+use Test::More tests => 54;
BEGIN {
delete $ENV{ANSI_COLORS_DISABLED};
@@ -58,6 +58,10 @@ 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",
@@ -137,3 +141,11 @@ like ($@, qr/^undefined subroutine \&Term::ANSIColor::RSET called at /,
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};
diff --git a/cpan/Term-ANSIColor/t/eval.t b/cpan/Term-ANSIColor/t/eval.t
new file mode 100644
index 0000000000..394368ee62
--- /dev/null
+++ b/cpan/Term-ANSIColor/t/eval.t
@@ -0,0 +1,25 @@
+#!/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');