Interactive debugging of rt-mailgate?

Hi all,

I’m tweaking rt-mailgate to add some new function, and I’ve progressed
to the point where I need to run the server part of rt-mailgate under
the perl debugger. I don’t know how to do it. (The commandline
approach of “cat samplemail | rt-mailgate --debug” is not adequate.)

I have the following script, which comes close to duplicating the
environment, but it isn’t close enough. (My mods work properly under
this environment, but do not work properly when real mail is sent to
the server.)

Can someone outline how to approach this?

Thanks!

#!/usr/local/bin/perl -w

use lib “/usr/local/rt/3.0.9.pre1/lib”;
use lib “/usr/local/rt/3.0.9.pre1/local/lib”;
use lib “/usr/local/rt/3.0.9.pre1/etc”;

use RT;
use MIME::Entity;
use Mail::Internet;
use MIME::Parser;
use RT::User;
use RT::Queue;
use RT::Ticket;
use RT::Transaction;
use RT::Interface::Email;

RT::LoadConfig();
RT::Init();
RT::DropSetGIDPermissions();

%ARGS = (
queue => 1,
action => “correspond”,
ticket => undef
);
$ARGS{‘message’} = cat /tmp/mailsample;

my ( $status, $error, $Ticket ) = RT::Interface::email::Gateway(%ARGS);
print “$status\n”, $error, “\n”;