Bug 94759 - g-cpan's "usage" message prints several warning due to uninitialized color variables
Bug#: 94759 Product:  Portage Development Version: unspecified Platform: x86
OS/Version: Linux Status: RESOLVED Severity: trivial Priority: P2
Resolution: FIXED Assigned To: mcummings@gentoo.org Reported By: gama@vettalabs.com
Component: Third-Party Tools
URL: 
Summary: g-cpan's "usage" message prints several warning due to uninitialized color variables
Keywords:  
Status Whiteboard: 
Opened: 2005-06-01 11:13 0000
Description:   Opened: 2005-06-01 11:13 0000
when invoking g-cpan with invalid parameters (i.e., "g-cpan --help"), the
"Usage" message is displayed, as usual. However, in version 0.13-r1, the
definion of the color variables (${white}, ${green}, etc) is done after the
"exit_usage()" method is called, thus causing several warning messages --
complaining about uninitialized variables -- to be printed before the usage
message itself -- and, as a side effect, the usage message has no colors.

Reproducible: Always
Steps to Reproduce:
1. emerge g-cpan
2. g-cpan --help

Actual Results:  
Before the usuage message was displayed, several "warnings" were printed, and
the usage message itself had no colors, as it was supposed to.

Expected Results:  
See above.

The following patch should fix it:

62,67d61
< # Set colors here so we can use them at will anywhere :)
< my $green = color("bold green");
< my $white = color ("bold white");
< my $cyan = color("bold cyan");
< my $reset = color("reset");
< 
81a76,81
> # Set colors here so we can use them at will anywhere :)
> my $green = color("bold green");
> my $white = color ("bold white");
> my $cyan = color("bold cyan");
> my $reset = color("reset");
>

------- Comment #1 From Michael Cummings (RETIRED) 2005-06-01 11:28:56 0000 -------
ack, i had this fixed at one point. expect in 13.01 (so i can avoid the whole 
mess i started with -r1). 

------- Comment #2 From Michael Cummings (RETIRED) 2005-06-01 13:40:04 0000 -------
0.13.01 is in the tree now :)