Skip Menu |
 

This queue is for tickets about the Term-ANSIColor CPAN distribution.

Report information
The Basics
Id: 69099
Status: resolved
Priority: 0/
Queue: Term-ANSIColor

People
Owner: Nobody in particular
Requestors: bitcard [...] oliver.seeliger.name
Cc:
AdminCc:

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



Subject: Array Ref issue in sub colored
Download (untitled) / with headers
text/plain 968b
The sub "colored" does only check if the passed parameter is a reference, but not if it's indeed an array refence. 227 sub colored { 228 my ($string, @codes); 229 if (ref $_[0]) { I think this should definitely be fixed. See the following script example. $ cat foo.pl #!/usr/bin/perl use Term::ANSIColor; print colored("ok\n", 'bold blue'); $foo = Foo->new(); print colored($foo . "", 'bold blue'); # stringify applies print colored($foo, 'bold blue'); # perl error package Foo; use overload '""' => 'stringify'; sub new { $self = {}; bless( $self ); } sub stringify { return "Foo Bar\n"; } $ perl foo.pl ok Foo Bar Not an ARRAY reference at /usr/local/share/perl/5.10.1/Term/ANSIColor.pm line 230. $ In my case it's a serious problem because I use Term::ANSIColor with Log::Log4Perl::Appender and DBIx::Class. In case of SQL error DBIx::Class passes a blessed reference into the ->log method o which then is passed tsub colored.
Download (untitled) / with headers
text/plain 114b
Thanks for the detailed report and the excellent test case. This has been fixed in 3.01, which was just released.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.