[rt-users] Perl script to dump mysql db transactions?
Stephen Turner
sturner at MIT.EDU
Fri Mar 4 10:26:37 EST 2005
At Thursday 3/3/2005 01:43 PM, Doug Barton wrote:
>Can you point me to some documentation for this? A search for "perl RT
API" on the wiki gives no results.
Doug,
The documentation is embedded in the code - for example, to see the doc for
the Ticket part of the API:
perldoc $RT_HOME/lib/Ticket.pm
perldoc $RT_HOME/lib/Ticket_Overlay.pm
Here's an example of a perl script that might get you started. It takes a
RT username as an argument and displays some info for that user. The script
will need to know where your RT libraries are, so add $RT_HOME/lib to @INC.
Digging around the mason components and perl libraries to see how they use
the API should help you get further.
Good luck,
Steve
#!/var/local/bin/perl
#
use RT::Interface::CLI qw (CleanEnv GetCurrentUser);
use RT::User;
die "Usage: $0 username" if scalar(@ARGV) != 1;
CleanEnv();
RT::LoadConfig();
RT::Init();
my $UserObj = new RT::User(RT::SystemUser);
my $user = new RT::User($UserObj);
my ($v, $m) = $user->Load($ARGV[0]);
if ($v) {
print "User found: ", $user->Name, " ", $user->EmailAddress, " ",
$user->RealName, "\n";
} else {
print "User NOT found: $m\n";
}
exit;
More information about the rt-users
mailing list