[Rt-devel] Use of UpdateRecordObject

Paul McFerrin pmcferrin at insight.rr.com
Thu Jul 22 02:44:16 EDT 2004


Hello:

I need a little help in determining the proper way of calling sub UpdateRecordObject ().

In looking at the Mason compiled version of Modify.html, I have come up with the following 
fragment of a call to update an existing user object.  I know it is not right but can't 
figure out the proper way.  The error msg I'm getting is:

    Can't use string ('Name') as a HASH ref ...

I suspect my problem is beginnng with the "ARGSRef => ..." argument?  Can someone set me 
straight?

-Paul M


#!/bld/RT/bin/perl -w
#

use lib "/bld/RT/lib";
package HTML::Mason::Commands;
use strict;
use English;
use RT::Interface::CLI qw(CleanEnv);
use RT::User;
use RT::Interface::Web;

...

my $usage = "Usage: rt-adduser [-n|-p] {posthandle}\n";

CleanEnv();
RT::LoadConfig();
RT::Init();

my $UserObj = new RT::User(RT::SystemUser);
# try updating existng object
     my @fields = qw(Name Comments Signature EmailAddress FreeformContactInfo
		    Organization RealName NickName Lang EmailEncoding WebEncoding
		    ExternalContactInfoId ContactInfoSystem Gecos ExternalAuthId
		    AuthSystem HomePhone WorkPhone MobilePhone PagerPhone Address1
		Address2 City State Zip Country
		   );
     my @fieldresults = UpdateRecordObject ( AttributesRef => \@fields,
					    Object => $UserObj,
					    ARGSRef =>
						Name => $name,
						EmailAddress => "$email",
		 				Password => "$passwd",
		 				Comments => "$comment",
                  				RealName => "$fullname",
		 				WorkPhone => "$tel",
		 				City => "$city",
		 				State => "$state",
		 				Zip => "$zip",
		 				Country => "$country",
		 				Privileged => $priv_rights);















More information about the Rt-devel mailing list