[rt-users] getting username from id

Stephen Turner sturner at MIT.EDU
Thu Mar 29 08:55:54 EDT 2007


At Thursday 3/29/2007 04:28 AM, Mathew Snyder wrote:
>         while (my $user = $users->Next) {
>             if ($user = $transaction->Creator) {
>                 $timeworked{$user} += $transaction->TimeTaken;
>             }
>             $environment{$environment}{$user->Name} = $timeworked{$user};
>         }

In the if statement, you are setting $user to $transaction->Creator, 
which is an integer. So $user is no longer a User object and hence no 
Name method.

Also, a comment - in looking at the code I did get confused by the 
dual use of "environment" to represent a scalar variable and a hash - 
might be better for code maintenance to choose different names.

Steve 




More information about the rt-users mailing list