[rt-users] RT::User problem
Gergely Buday
gbuday at gmail.com
Mon Aug 13 07:22:50 EDT 2012
Hi there,
I would like to create a User object through the Load method. The
documentation writes:
"Load a user object from the database. Takes a single argument. If
the argument is numerical, load by the column 'id'. If a user object
or its subclass passed then loads the same user by id. Otherwise,
load by the "Name" column which is the user's textual username."
#!/usr/bin/perl
use strict;
use lib "/opt/rt4/lib";
use lib "/opt/rt4/local/lib";
use RT;
use RT::User;
RT->LoadConfig;
RT->Init;
my $test_user = RT::User::Load('bg at buday-rd.hu');
printf "\$test_user=", $test_user;
my @to = $test_user->EmailAddress;
for $a (0 .. $#to)
{
print $to[$a], "\n";
}
Running this script with sudo makes it say
[Mon Aug 13 11:16:47 2012] [crit]: Can't call method "EmailAddress" on
an undefined value at ./email.pl line 13. (/opt/rt4/lib/RT.pm:341)
Can't call method "EmailAddress" on an undefined value at ./email.pl line 13.
The username I used in the place of me at company.com is indeed a valid
user name. What is the problem then?
- Gergely
More information about the rt-users
mailing list