Subroutine redifined error on fresh 4.2 installation

Trying to figure out why I keep getting various “Subroutine * redefined at
/opt/rt4/lib/RT/…” error.

All I’m trying to do right now is print out a list of new, unowned tickets
from a queue.


use warnings;
use strict;
use lib ‘/opt/rt4/lib/RT’;
use lib ‘/opt/rt4/local/lib’;
use RT::Tickets;
use RT::Users;

my $unacted_tickets;
my $tix = new RT::Tickets(“RT::SystemUser”);
$tix->FromSQL(‘Queue = “Service Desk” AND Status = “new” AND Owner =

while (my $ticket = $tix->Next) {
my $diff = time - (str2time($ticket->Created) - 18000);
print $ticket->id . “: " . (str2time($ticket->Created) - 18000) .
print "time: " . time() . “\n”;
print "diff: " . $diff . “\n”;
print "diff adjusted: " . $diff/60 . “\n”;


Subroutine new redefined at /opt/rt4/lib/RT/ line 83.
Subroutine CanonicalizeURI redefined at /opt/rt4/lib/RT/ line 102.
Subroutine FromObject redefined at /opt/rt4/lib/RT/ line 123.
Subroutine FromURI redefined at /opt/rt4/lib/RT/ line 142.
Subroutine _GetResolver redefined at /opt/rt4/lib/RT/ line 186.
Subroutine Scheme redefined at /opt/rt4/lib/RT/ line 218.
Subroutine URI redefined at /opt/rt4/lib/RT/ line 231.
Subroutine Object redefined at /opt/rt4/lib/RT/ line 245.
Subroutine IsLocal redefined at /opt/rt4/lib/RT/ line 260.
Subroutine AsHREF redefined at /opt/rt4/lib/RT/ line 273.
Subroutine Resolver redefined at /opt/rt4/lib/RT/ line 285.
Subroutine AsString redefined at /opt/rt4/lib/RT/ line 296.
Can’t call method “error” on an undefined value at
/opt/rt4/lib/RT/ line 3001.

It’s been a while since I’ve written scripts that use the RT API so I don’t
know if things have changed in how the environment is set up. What am I
doing wrong?


“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

there are two mistakes in your script:

  1. You should include use RT -init; command somewhere in use section. This causes the “Can’t call method “error” on an undefined value” to dissapear.
  2. Warnings like “Subroutine new redefined at…” dissapear after commenting the use lib '/opt/rt4/local/lib'; line.