Subroutines in template code?

Hi!

I’m try to code a workflow with the “CreateTicket” Stuff. I have to
create 5 tickets. All the tickets share a code block, but i have no idea
how to define a “sub” in the template? I’ve already tried in an separate
block in front of the tickets, but i couldn’t call it (func_name() and
main::func_name())

could i define a sub and how i have to call it?

bye!

Sven Sternberger wrote:

Hi!

I’m try to code a workflow with the “CreateTicket” Stuff. I have to
create 5 tickets. All the tickets share a code block, but i have no idea
how to define a “sub” in the template? I’ve already tried in an separate
block in front of the tickets, but i couldn’t call it (func_name() and
main::func_name())

could i define a sub and how i have to call it?
Could you please share small part of teplate that will show as what you
try to do.

Hello!

could i define a sub and how i have to call it?

Could you please share small part of teplate that will show as what
you try to do.

Here comes the template (this don’t work)

{
sub my_func {
return “Hello World”;
}
}

===Create-Ticket: my_template_1
Content: { my_func(); }

===Create-Ticket: my_template_2
Content: { my_func(); }
<<

hope this is understandable!

bye and thanx!

As fasr as I can see from CreateTicket.pm prepare sub ignore blocks
before any ===Create-Ticket. Not exactly ignore, but lost due assignment.


my $template_id;
foreach my $line (split(/\n/,$self->TemplateObj->Content)) {
if ($line =~ /^===Create-Ticket: (.*)$/) {
$template_id = $1;
push @{$self->{‘template_order’}},$template_id;
} else {
$self->{‘templates’}->{$template_id} .= $line."\n";
}

}

Sven Sternberger wrote: