On Wed, Apr 30, 2008 at 6:25 PM, Kevin Falcone <[EMAIL PROTECTED]>
wrote:

> Try
> my $ticket = RT::Ticket->new( $RT::SystemUser );
>

Wooho! It works! Don't ask me to explain why....

Below is my program as it looks now. Since I don't want to run it as root I
hacked some of the constants from the RT_SiteConfig.pm directly into the
code itself.

But the way I did it, by making my own "package RT"... looks ugly.

Sugestions?

-- 
/Morten %-)

#!/usr/bin/perl

package RT;
our $DatabaseType     = 'mysql';
our $DatabaseUser     = 'rtuser';
our $DatabasePassword = 'dbpw';
our $DatabaseName     = 'rtdb';

package main;
use strict;
use warnings;
use Data::Dumper;

use lib '/usr/share/request-tracker3.6/lib';
use RT;
use RT::Tickets;

RT::Init();

my $u = RT::CurrentUser->new( 'cust-12345' );
die "Password error\n" unless RT::CurrentUser::IsPassword($u, 'magic');

my $ticket = new RT::Ticket($u);
$ticket->Load( 286 );
printf "%5s: %-50s (%s)\n", $ticket->id, $ticket->Subject, $ticket->Status;
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

Reply via email to