Alister West

home is where your code is ...

Perl - Request Tracker (RT) - Create Ticket.

Lots of RT users want requestors to see a different interface to RT. Usually a custom form on their intranet. From this you can create the inital ticket several ways.

local cgi script using command-line-interface (cli).

#!/usr/bin/env perl
use strict;
die "Test and re-write this code!";

# Get args from the cgi environment somehow
use CGI; my $cgi = CGI->new;

# Make sure to escape your args !!
my $rtcmd = "/var/home/alister/rt.alister.com/rt/bin/rt ";
my ($subject, $requestor, $queue) =
    map { (my $tmp = $cgi->param($_)) =~ s/'/\'/g; $tmp }
    qw/Subject Requestor Queue/;

$cgi->redirect('http://somewhere.com/done?message=error') unless $subject;

# create ticket using CLI
my $output = system(
    $rtcmd, "create -t ticket ",
    "set subject='$subject' ", "status='notify'",
    "Requestor='$requestor'",  "queue='$queue'"
);

$cgi->redirect('http://somewhere.com/done?message=success');
By Alister West