Is there any way I can pass a reference to one of the template directives to a sub routine in another package? I've tried a couple of things but couldn't get it, I'm hoping that its possible so I can wrap common functionality into package calls that are used throughout all our WFTs.
package TeamSite::Workflow::Template::Common;
sub new {
my ($class, $elem, $value, $cgi_info, $tag_info) = (shift, shift, shift, shift, shift);
my $this = {
__ELEM__ => $elem,
__VALUE__ => $value,
CGI_info => $cgi_info,
TAG_info => $tag_info
};
$class = ref($class) || $class;
bless($this, $class);
return $this;
}
sub EnableDebug {
my $this = shift;
$this->{TAG_info}(
# ... normal TAG_info call ...
);
}
1;
In the .wft files template_script section
use TeamSite::Workflow::Template::Common;
my $wf = TeamSite::Workflow::Template::Common->new(\__ELEM__, \__VALUE__, \CGI_info, \TAG_info);
$wf->EnableDebug();
... I've noticed that the directives are replaced or prefixed with $_this_-> ... I've tried \$_this_->__VALUE__ but that didn't work ... hopefully someone can enlighten me