On Tue, Jul 03, 2012 at 11:02:55PM -0400, Michael Coakley wrote: > 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
> 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
pgpi6EkbReTC1.pgp
Description: PGP signature
