Scrip compile issue

I’m trying to write a Scrip that replaces the Requestor. When I try to save this Scrip I get a compilation error.

Here is my Scrip:

my %addressSubstitutions = (
"ex1@example.com" => "ex1location@example.com",
"ex2@example.com" => "ex2location@example.com"
);

my $newRequestorAddr = “”;

my $requestorAddr = $self->TicketObj->RequestorAddresses;
$RT::Logger->debug(“All Queues: Requestor Email Address = $requestorAddr”);

foreach $testAddress (keys(%addressSubstitutions)) {
if ($requestorAddr =~ /$testAddress/i) {
$newRequestorAddr = $addressSubstitutions{$testAddress};
break;
}
}

my ($status, $msg) = $self->TicketObj->DeleteWatcher(Type => ‘Requestor’, Email => $requestorAddr);
unless ($status) {
$RT::Logger->error(“All Queues : Unable to Remove the requestor $requestorAddr : $msg”);
return undef;
}

my ($status, $msg) = $self->TicketObj->AddWatcher(Type => ‘Requestor’, Email => $newRequestorAddr);
unless ($status) {
$RT::Logger->error(“All Queues : Unable to Add the requestor $newRequestorAddr : $msg”);
return undef;
}

return 1;

Here is the error:

Couldn’t compile CustomCommitCode codeblock ‘{Scrip}’: Compilation error at /usr/lib/perl5/site_perl/5.14.2/Log/Dispatch/Output.pm line 39. Stack: [/usr/lib/perl5/site_perl/5.14.2/Log/Dispatch/Output.pm:39] [/usr/lib/perl5/site_perl/5.14.2/Log/Dispatch.pm:192] [/usr/lib/perl5/site_perl/5.14.2/Log/Dispatch.pm:145] [/usr/lib/perl5/site_perl/5.14.2/Log/Dispatch.pm:123] [(eval 1261):44] [/opt/rt4/share/html/Admin/Elements/EditScrip:155] [/opt/rt4/share/html/Admin/Global/Scrip.html:51] [/opt/rt4/share/html/Admin/autohandler:49] [/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:548] [/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:295] [/opt/rt4/share/html/autohandler:53]

Thanks,

Mike

Mike,

Replaces the Requestor? How? In what manner? If you just want the Requestor
to have a different title or name then use the language translator. There
is an array in it that lets you replace certain items when they are
displayed.

KennOn Tue, Jul 3, 2012 at 8:02 PM, Michael Coakley mike.coakley@gmail.comwrote:

I’m trying to write a Scrip that replaces the Requestor. When I try to
save this Scrip I get a compilation error.

Here is my Scrip:

my %addressSubstitutions = (
“ex1@example.com” => “ex1location@example.com”,
“ex2@example.com” => “ex2location@example.com”
);

my $newRequestorAddr = “”;

my $requestorAddr = $self->TicketObj->RequestorAddresses;
$RT::Logger->debug(“All Queues: Requestor Email Address = $requestorAddr”);

foreach $testAddress (keys(%addressSubstitutions)) {
if ($requestorAddr =~ /$testAddress/i) {
$newRequestorAddr =
$addressSubstitutions{$testAddress};
break;
}
}

my ($status, $msg) = $self->TicketObj->DeleteWatcher(Type => ‘Requestor’,
Email => $requestorAddr);
unless ($status) {
$RT::Logger->error(“All Queues : Unable to Remove the
requestor $requestorAddr : $msg”);
return undef;
}

my ($status, $msg) = $self->TicketObj->AddWatcher(Type => ‘Requestor’,
Email => $newRequestorAddr);
unless ($status) {
$RT::Logger->error(“All Queues : Unable to Add the
requestor $newRequestorAddr : $msg”);
return undef;
}

return 1;

Here is the error:

Couldn’t compile CustomCommitCode codeblock ‘{Scrip}': Compilation error
at /usr/lib/perl5/site_perl/5.14.2/Log/Dispatch/Output.pm line 39. Stack:
[/usr/lib/perl5/site_perl/5.14.2/Log/Dispatch/Output.pm:39]
[/usr/lib/perl5/site_perl/5.14.2/Log/Dispatch.pm:192]
[/usr/lib/perl5/site_perl/5.14.2/Log/Dispatch.pm:145]
[/usr/lib/perl5/site_perl/5.14.2/Log/Dispatch.pm:123] [(eval 1261):44]
[/opt/rt4/share/html/Admin/Elements/EditScrip:155]
[/opt/rt4/share/html/Admin/Global/Scrip.html:51]
[/opt/rt4/share/html/Admin/autohandler:49]
[/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:548]
[/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:295]
[/opt/rt4/share/html/autohandler:53]

Thanks,

Mike

Kenn,

Basically I have scanners that email scanned applications to the RT system. If the reply goes back to the scanner email address it gets dumped. So I need the reply to go back to the group that scanned the application. That is why I built the replacement routine.

It works fine at the command line, excluding the RT parts for testing. But when I save it in the RT web ui I get the error below.

Thanks,

MikeOn Jul 5, 2012, at 4:21 PM, Kenneth Crocker kenn.crocker@gmail.com wrote:

Mike,

Replaces the Requestor? How? In what manner? If you just want the Requestor to have a different title or name then use the language translator. There is an array in it that lets you replace certain items when they are displayed.

Kenn

On Tue, Jul 3, 2012 at 8:02 PM, Michael Coakley mike.coakley@gmail.com wrote:
I’m trying to write a Scrip that replaces the Requestor. When I try to save this Scrip I get a compilation error.

Here is my Scrip:

my %addressSubstitutions = (
“ex1@example.com” => “ex1location@example.com”,
“ex2@example.com” => “ex2location@example.com”
);

my $newRequestorAddr = “”;

my $requestorAddr = $self->TicketObj->RequestorAddresses;
$RT::Logger->debug(“All Queues: Requestor Email Address = $requestorAddr”);

foreach $testAddress (keys(%addressSubstitutions)) {
if ($requestorAddr =~ /$testAddress/i) {
$newRequestorAddr = $addressSubstitutions{$testAddress};
break;
}
}

my ($status, $msg) = $self->TicketObj->DeleteWatcher(Type => ‘Requestor’, Email => $requestorAddr);
unless ($status) {
$RT::Logger->error(“All Queues : Unable to Remove the requestor $requestorAddr : $msg”);
return undef;
}

my ($status, $msg) = $self->TicketObj->AddWatcher(Type => ‘Requestor’, Email => $newRequestorAddr);
unless ($status) {
$RT::Logger->error(“All Queues : Unable to Add the requestor $newRequestorAddr : $msg”);
return undef;
}

return 1;

Here is the error:

Couldn’t compile CustomCommitCode codeblock ‘{Scrip}': Compilation error at /usr/lib/perl5/site_perl/5.14.2/Log/Dispatch/Output.pm line 39. Stack: [/usr/lib/perl5/site_perl/5.14.2/Log/Dispatch/Output.pm:39] [/usr/lib/perl5/site_perl/5.14.2/Log/Dispatch.pm:192] [/usr/lib/perl5/site_perl/5.14.2/Log/Dispatch.pm:145] [/usr/lib/perl5/site_perl/5.14.2/Log/Dispatch.pm:123] [(eval 1261):44] [/opt/rt4/share/html/Admin/Elements/EditScrip:155] [/opt/rt4/share/html/Admin/Global/Scrip.html:51] [/opt/rt4/share/html/Admin/autohandler:49] [/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:548] [/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:295] [/opt/rt4/share/html/autohandler:53]

Thanks,

Mike

I’m trying to write a Scrip that replaces the Requestor. When I try to save this Scrip I get a compilation error.

I’m not sure break; is really what you mean. Try last; It’s highly
perl version dependent and RT doesn’t declare any of the new perl
features because we still run on 5.8.

-kevin

Mike,

If you can define that user, why not modify the email address to show the
group address you want it to go to. That way the “Reply to Requestor” will
work the way you want and you won’t need the code?

KennOn Thu, Jul 5, 2012 at 1:29 PM, Michael Coakley mike.coakley@gmail.comwrote:

Kenn,

Basically I have scanners that email scanned applications to the RT
system. If the reply goes back to the scanner email address it gets dumped.
So I need the reply to go back to the group that scanned the application.
That is why I built the replacement routine.

It works fine at the command line, excluding the RT parts for testing. But
when I save it in the RT web ui I get the error below.

Thanks,

Mike

Sent from my iPhone

On Jul 5, 2012, at 4:21 PM, Kenneth Crocker kenn.crocker@gmail.com wrote:

Mike,

Replaces the Requestor? How? In what manner? If you just want the
Requestor to have a different title or name then use the language
translator. There is an array in it that lets you replace certain items
when they are displayed.

Kenn

On Tue, Jul 3, 2012 at 8:02 PM, Michael Coakley mike.coakley@gmail.comwrote:

I’m trying to write a Scrip that replaces the Requestor. When I try to
save this Scrip I get a compilation error.

Here is my Scrip:

my %addressSubstitutions = (
“ex1@example.com” => “ex1location@example.com”,
“ex2@example.com” => “ex2location@example.com”
);

my $newRequestorAddr = “”;

my $requestorAddr = $self->TicketObj->RequestorAddresses;
$RT::Logger->debug(“All Queues: Requestor Email Address =
$requestorAddr”);

foreach $testAddress (keys(%addressSubstitutions)) {
if ($requestorAddr =~ /$testAddress/i) {
$newRequestorAddr =
$addressSubstitutions{$testAddress};
break;
}
}

my ($status, $msg) = $self->TicketObj->DeleteWatcher(Type => ‘Requestor’,
Email => $requestorAddr);
unless ($status) {
$RT::Logger->error(“All Queues : Unable to Remove the
requestor $requestorAddr : $msg”);
return undef;
}

my ($status, $msg) = $self->TicketObj->AddWatcher(Type => ‘Requestor’,
Email => $newRequestorAddr);
unless ($status) {
$RT::Logger->error(“All Queues : Unable to Add the
requestor $newRequestorAddr : $msg”);
return undef;
}

return 1;

Here is the error:

Couldn’t compile CustomCommitCode codeblock ‘{Scrip}': Compilation error
at /usr/lib/perl5/site_perl/5.14.2/Log/Dispatch/Output.pm line 39. Stack:
[/usr/lib/perl5/site_perl/5.14.2/Log/Dispatch/Output.pm:39]
[/usr/lib/perl5/site_perl/5.14.2/Log/Dispatch.pm:192]
[/usr/lib/perl5/site_perl/5.14.2/Log/Dispatch.pm:145]
[/usr/lib/perl5/site_perl/5.14.2/Log/Dispatch.pm:123] [(eval 1261):44]
[/opt/rt4/share/html/Admin/Elements/EditScrip:155]
[/opt/rt4/share/html/Admin/Global/Scrip.html:51]
[/opt/rt4/share/html/Admin/autohandler:49]
[/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:548]
[/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:295]
[/opt/rt4/share/html/autohandler:53]

Thanks,

Mike

Kenn,

Actually after I sent the message I did actually think of the best answer
for 95% of the cases; that is to simply add the address to the distribution
list. But that other 5% we are actually determining the Requestor address
based upon the queue it is going to. (Didn’t show that in the code because
I didn’t write it yet so it wasn’t relevant to the error.) While your
answer would also satisfy the 95% I don’t think it addresses the 5% like my
solution.

I’m going to try Kevin’s solution tomorrow and report back.

Mike

Mike,

If you can define that user, why not modify the email address to show the
group address you want it to go to. That way the “Reply to Requestor” will
work the way you want and you won’t need the code?

KennOn Thu, Jul 5, 2012 at 1:29 PM, Michael Coakley mike.coakley@gmail.comwrote:

Kenn,

Basically I have scanners that email scanned applications to the RT
system. If the reply goes back to the scanner email address it gets dumped.
So I need the reply to go back to the group that scanned the application.
That is why I built the replacement routine.

It works fine at the command line, excluding the RT parts for testing. But
when I save it in the RT web ui I get the error below.

Thanks,

Mike

Sent from my iPhone

On Jul 5, 2012, at 4:21 PM, Kenneth Crocker kenn.crocker@gmail.com wrote:

Mike,

Replaces the Requestor? How? In what manner? If you just want the
Requestor to have a different title or name then use the language
translator. There is an array in it that lets you replace certain items
when they are displayed.

Kenn

On Tue, Jul 3, 2012 at 8:02 PM, Michael Coakley mike.coakley@gmail.comwrote:

I’m trying to write a Scrip that replaces the Requestor. When I try to
save this Scrip I get a compilation error.

Here is my Scrip:

my %addressSubstitutions = (
“ex1@example.com” => “ex1location@example.com”,
“ex2@example.com” => “ex2location@example.com”
);

my $newRequestorAddr = “”;

my $requestorAddr = $self->TicketObj->RequestorAddresses;
$RT::Logger->debug(“All Queues: Requestor Email Address =
$requestorAddr”);

foreach $testAddress (keys(%addressSubstitutions)) {
if ($requestorAddr =~ /$testAddress/i) {
$newRequestorAddr =
$addressSubstitutions{$testAddress};
break;
}
}

my ($status, $msg) = $self->TicketObj->DeleteWatcher(Type => ‘Requestor’,
Email => $requestorAddr);
unless ($status) {
$RT::Logger->error(“All Queues : Unable to Remove the
requestor $requestorAddr : $msg”);
return undef;
}

my ($status, $msg) = $self->TicketObj->AddWatcher(Type => ‘Requestor’,
Email => $newRequestorAddr);
unless ($status) {
$RT::Logger->error(“All Queues : Unable to Add the
requestor $newRequestorAddr : $msg”);
return undef;
}

return 1;

Here is the error:

Couldn’t compile CustomCommitCode codeblock ‘{Scrip}': Compilation error
at /usr/lib/perl5/site_perl/5.14.2/Log/Dispatch/Output.pm line 39. Stack:
[/usr/lib/perl5/site_perl/5.14.2/Log/Dispatch/Output.pm:39]
[/usr/lib/perl5/site_perl/5.14.2/Log/Dispatch.pm:192]
[/usr/lib/perl5/site_perl/5.14.2/Log/Dispatch.pm:145]
[/usr/lib/perl5/site_perl/5.14.2/Log/Dispatch.pm:123] [(eval 1261):44]
[/opt/rt4/share/html/Admin/Elements/EditScrip:155]
[/opt/rt4/share/html/Admin/Global/Scrip.html:51]
[/opt/rt4/share/html/Admin/autohandler:49]
[/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:548]
[/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:295]
[/opt/rt4/share/html/autohandler:53]

Thanks,

Mike