in reply to Bug in Template?

I apologise for being off-topic right in the first reply, but:

my $vars = { cases => @cases };

This poked me in the eye, and I don’t think you can do that — well, you can, but you probably shouldn’t. This will create $vars with { cases => $cases[0], "$cases[1]" => $cases[2], … } and that’s more than likely not what you want.