Code needed to get the current user

Hello,

I’m having some trouble getting the current user in a perl script. I
have the headers:

#!/usr/bin/perl

use lib "/opt/rt3/lib";
use lib "/opt/rt3/etc";

package RT;

use strict;
use RT;
use RT::Ticket;
use DBI;
use RT::CurrentUser;
use RT::Interface::CLI qw( CleanEnv GetCurrentUser );

# Load the RT configuration
RT::LoadConfig();
# Initialise RT
RT::Init();

in my script and I use:

my $CurrentUser = GetCurrentUser();

which should return the CurrentUser object, right? If I do this:

my $ticket = new RT::Ticket($CurrentUser);

I get:

[Thu Jan 19 16:31:19 2006] [error] [client 131.231.82.229] [Thu Jan 19
16:31:19 2006] [err]: Couldn’t load from the users database., referer:
http://gilo/Ticket/Create.html?casetype=Problem&Queue=Helpdesk
[Thu Jan 19 16:31:19 2006] [error] [client 131.231.82.229]
(/opt/rt3/lib/RT/CurrentUser.pm:146), referer:
http://gilo/Ticket/Create.html?casetype=Problem&Queue=Helpdesk

If I print $CurrentUser to the error log, it shows a hash ref, so the
object is there, right?

Where am I going wrong?

TIA,

Stewart
Stewart Tranter
Computing Services
Loughborough University

E: s.g.tranter@lboro.ac.uk
W: http://www.lboro.ac.uk/computing/
T: +44 (0) 1509 223719
F: +44 (0) 1509 223989