[rt-users] Interface::CLI and Queue auto-create

Jens Porup jens at cyber.com.au
Mon Sep 6 22:46:20 EDT 2004


On Mon, Sep 06, 2004 at 03:47:09PM +1000, Jens Porup wrote:
> 
> I have read the docs--thoroughly--and searched the list archives, but I
> am not finding what I need to do this.
> 
> I perldoc all the wonderful files, and the API seems documented
> clear as day.
> 
> But when I try and do a "use RT::Queue" and then "my $new_q = new
> RT::Queue()" nothing happens.
> 
> I've checked out several of the scripts on the RTWiki/Contributions site
> hoping to find inspiration, but nothing seems to work!
> 
> How do I get the object I need to call all these wonderfully documented
> APIs that I can't seem to get any acces to???
> 
> Thanks,
> 
> Jens

What? No one? 

Here's my script. It doesn't seem to do anything.

	#!/usr/bin/perl

	use strict;
	use warnings;

	use lib '/opt/rt3/lib';
	use RT::Interface::CLI qw(CleanEnv GetCurrentUser GetMessageContent loc);

	CleanEnv();

	use RT;
	use RT::Queue;
	use RT::Queues;

	#load RT's config file
	RT::LoadConfig();

	# Connect to the database. set up logging
	RT::Init();

	#Get the current user all loaded
	my $CurrentUser = GetCurrentUser();

	print loc("what does this loc method do anyhow?\n"); # Synonym of $CurrentUser->loc('Hello!');

	my $nq = new RT::Queue($CurrentUser);
	#my $nq = RT::Queues->NewItem();

	$nq->Create({       Name => "FOOOOOOOOOOOOO",
						Description =>  "testdesc",
						CorrespondAddress => "foo",
						CommentAddress => "bar",
						InitialPriority => "12",
						FinalPriority => "43"
				});






More information about the rt-users mailing list