------------------------------ Message: 2 Date: Mon, 13 Aug 2012 13:22:50 +0200 From: Gergely Buday <[email protected]> To: [email protected] Subject: [rt-users] RT::User problem Message-ID: <CA+3iOzksxuc4T6hpwyX3=faehzsbpwxhywm3t_-rmex7uqw...@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 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('[email protected]'); 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 [email protected] is indeed a valid user name. What is the problem then? - Gergely

Hello Gergely,

you can only load a user by id or by E-mail address. The routine is LoadByEmail.


Greetings,

Wolfram


   <https://rt-testsys-1/Developer/Perldoc/Body.html?n=RT::User#___top>

Reply via email to