How to skip the rest of template

Hi there,
I can not easily find a way to skip a rest of complex template if some condition is met. In quite simple templates this could be done by if-else blocks but when there are many perl blocks it could be difficult because each block is processed independently. I would be glad if worked something like (for queue change) in pseudo-code:



{ print ticket_header_info();
  compute $condition;
  if $condition print something;
}

{
  compute $condition; #the same condition as above
  exit if $condition;
}

ADITIONAL INFO:
some text here

So if the condition is met then skip processing (and printing) the “aditional info” section and below. How can I do that while return is not enough because it wouldn’t stop perl from processing the other blocks? But exit is too powerfull because the template is not processed ever.

What I’ve done for complex templates is generate the template contents dynamically in one or more variables in one large Perl block and then output that at the end. If there’s no output required, I just make sure that the variable(s) are empty.

Yes, this is apparently the only solution. I had to rewrite some complex templates with “spaghetti code” into this. I wanted to avoid that but no chance :slight_smile: