On Wed, Apr 30, 2008 at 6:25 PM, Kevin Falcone <<a href="mailto:falcone@bestpractical.com">falcone@bestpractical.com</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="">Try<br><div><div>my $ticket = RT::Ticket->new( $RT::SystemUser );</div><div><div></div></div></div></div></blockquote><br>Wooho! It works! Don't ask me to explain why....<br><br>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.<br>
<br>But the way I did it, by making my own "package RT"... looks ugly. <br><br>Sugestions?<br></div><br>-- <br>/Morten %-)<br><br>#!/usr/bin/perl<br><br>package RT;<br>our $DatabaseType = 'mysql';<br>
our $DatabaseUser = 'rtuser';<br>our $DatabasePassword = 'dbpw';<br>our $DatabaseName = 'rtdb';<br><br>package main;<br>use strict;<br>use warnings;<br>use Data::Dumper;<br><br>use lib '/usr/share/request-tracker3.6/lib';<br>
use RT;<br>use RT::Tickets;<br><br>RT::Init();<br><br>my $u = RT::CurrentUser->new( 'cust-12345' );<br>die "Password error\n" unless RT::CurrentUser::IsPassword($u, 'magic');<br><br>my $ticket = new RT::Ticket($u);<br>
$ticket->Load( 286 );<br>printf "%5s: %-50s (%s)\n", $ticket->id, $ticket->Subject, $ticket->Status;<br><br>