On Wed, Aug 06, 2014 at 12:46:17PM -0400, Michael Mol wrote:
> First attempt at writing an RT scrip, and I'm getting a compile error
> I can't easily identify as a problem with my code. Googling around
> finds "sv_setpvn called with negative strlen -2" in multiple results,
> but none of them in StackTrace.pm, mostly a lot of stuff surrounding
> Unicode.

You've panic'ed perl.

I assume you're on mod_perl.

> ## Begin code snippet
> # Find the message from transactionobj->content
> # Set the subject to the message by using ticketobj->SetSubject
> 
> my $body = $self->TransactionObj->Content;
> 
> open my $fh '<', \$body or return 0;
> 
> my $trapID = <$fh>; chomp $trapID;
> <$fh>;
> my $messageLine = <$fh>; chomp $messageLine;
> 
> $self->TicketObj->SetSubject("$trapID -- $messageLine);
> 
> close $fh;

Why are you turning a perfectly good string into a file handle just to
read three lines?  Split it on newlines or write a regexp.

-kevin

Attachment: pgp8tVOW_JTQb.pgp
Description: PGP signature

-- 
RT Training - Boston, September 9-10
http://bestpractical.com/training

Reply via email to