Problem with transactionbatch and unblessed

I think I am making a silly mistake, but I can not see it.

Template as follows on 3.4.2:

blah

{
my $old_user = $Ticket->CurrentUser;
$Ticket->CurrentUser( $RT::SystemUser );
my $batch = $Ticket->TransactionBatch;
my $comment;
if( !$batch || !ref($batch) ) {
$RT::Logger->info(“TransactionBatch stage is disabled.”);
} else {
$RT::Logger->info(“LCM batch “,@$batch);
while (my $trans = $batch->Next) {
$OUT .= $trans->CreatedObj->AsString . “: " . $trans->Description;
if ($trans->TimeTaken) {
$OUT .= " (”.$trans->TimeTaken.” min)”;
}
$OUT .= “\n”;
if ($trans->Content) {
$OUT .= $trans->Content . “\n”;
}
$OUT .= (’-'x78)."\n";
}
}
$Ticket->CurrentUser( $old_user );

}

Error I am getting is:

[Mon Aug 8 21:37:30 2005] [debug]: Found 1 scrips
(/usr/local/rt-dev/lib/RT/Scr
ips_Overlay.pm:354)
[Mon Aug 8 21:37:30 2005] [error]: Template parsing error: Can’t call
method “N
ext” on unblessed reference at template line 13.

Stack:
[template:13]
[/usr/local/rt-dev/lib/RT/Template_Overlay.pm:416]
[/usr/local/rt-dev/lib/RT/Template_Overlay.pm:340]
[/usr/local/rt-dev/lib/RT/Action/SendEmail.pm:112]
[/usr/local/rt-dev/lib/RT/Action/Notify.pm:65]
[/usr/local/rt-dev/lib/RT/ScripAction_Overlay.pm:220]
[/usr/local/rt-dev/lib/RT/Scrip_Overlay.pm:477]
[/usr/local/rt-dev/lib/RT/Scrips_Overlay.pm:235]
[/usr/local/rt-dev/lib/RT/Scrips_Overlay.pm:174]
[/usr/local/rt-dev/lib/RT/Ticket_Overlay.pm:3354]
(/usr/local/rt-dev/lib/RT/Template_Overlay.pm:412)
[Mon Aug 8 21:37:30 2005] [error]: error: unexpected end of header

I know that $batch has 4-5 transactions in there based on:

[Mon Aug 8 21:47:28 2005] [info]: batch RT::Transaction=HASH(0x8522d70)
RT::Transaction=HASH(0xa5d6188) RT::Transaction=HASH0xa5cf25c)
RT::Transaction=HASH(0xa5e8e78) RT::Transaction=HASH(0xa5f3f5c)
(template:13)

Why doesn’t the Next method work?

Any help appreciated.

This email, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity
to which it is addressed. If the reader of this email is not the
intended recipient or his or her authorized agent, the reader is
hereby notified that any dissemination, distribution or copying of this
email is prohibited. If you have received this email in error,
please notify the sender by replying to this message and delete this
email immediately.