Keep getting "was created without a CurrentUser" error

The following, very simply code returns an error:

#!/usr/bin/perl

use warnings;
use strict;
use lib ‘/opt/rt4/lib’;
use lib ‘/opt/rt4/local/lib’;

Test basic connection to RT

my $queues = RT::Queues->new( RT->SystemUser );
while ( my $queue = $queues->Next ) {
print $queue->Name . “\n”;
}

The error:
RT::Queues=HASH(0x43326e0) was created without a CurrentUser at
/opt/rt4/lib/RT/SearchBuilder.pm line 84.
RT::SearchBuilder::_Init(RT::Queues=HASH(0x43326e0), undef) called at
/opt/rt4/lib/RT/Queues.pm line 88
RT::Queues::_Init(RT::Queues=HASH(0x43326e0), undef) called at
/usr/local/share/perl5/DBIx/SearchBuilder.pm line 95
DBIx::SearchBuilder::new(“RT::Queues”, undef) called at ./
cc_ticket_alert.pl line 34

If, instead of creating $queues the way above, I create it like so:

my $queues = new RT::Queues( “RT::SystemUser” );

and adding

use RT::Queues;

it will run, but not return anything.

Any idea what I’m doing wrong?

-Mathew

“When you do things right, people won’t be sure you’ve done anything at
all.” - God; Futurama

“We’ll get along much better once you accept that you’re wrong and neither
am I.” - Me