[rt-users] Subroutines in template code?

Ruslan U. Zakirov cubic at acronis.ru
Fri Aug 27 04:15:22 EDT 2004


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:
> 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
> Subject: A template with a sub call!
> Content: { my_func(); }
> 
> ===Create-Ticket: my_template_2
> Subject: A second template with a sub call!
> Content: { my_func(); }
> <<
> 
> hope this is understandable!
> 
> bye and thanx!




More information about the rt-users mailing list