> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 23, 2003 1:18 PM
> To: [EMAIL PROTECTED]
> Subject: Colorize Table Elements
> 
> 
> I am creating a program that will display different states of 
> a server by creating a web page that uses the CGI module to 
> display the information, and perl and other modules in the 
> background getting the information from the server. 
> 
> I have created a hash that has the ID and STATUS of certain 
> processes of the server. The array looks something like this:
> 
> { 43.2 => "QUEUED",
>   43.4 => "STARTED", ...}
> 
> There are four different states that the processes can be in, 
> queued, started, vacating, and finished. I already have it 
> delete all of the hash entries that have the status of 
> finished, but I now want to colorize the other ones so that 
> it is easy to see what state they are in. I put all of the 
> keys from the hash (called condorhash) into @keysarray. This 
> is a snippet of code that I have written.
> 
>     foreach my $keyer  (@keysarray) {
>         if ($condorhash{$keyer} eq "FINISHED" ) {delete 
> $condorhash{$keyer}}; 
>         if ($condorhash{$keyer} eq "STARTED") 
> {$condorhash{$keyer} = "font({-color=>'green'}STARTED)"};
>         if ($condorhash{$keyer} eq "VACATING") 
> {$condorhash{$keyer} = "font({-color=>'red'}VACATING)"};
>         if ($condorhash{$keyer} eq "QUEUED") 
> {$condorhash{$keyer} = "font({-color=>'dark blue'}QUEUED)"};
>     }
> 
> It doesn't work and I am not completely sure why. I think I 
> am missing something small here but I am not sure what. Please help!
> 
I see 1 small thing here, if the value is FINISHED, you delete the key, then
go on and try and use it again in 3 more conditional tests.  You could put
that test last, or you could add a next after the delete.

-Mark

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to