[htmltmpl] Filter Syntax
Brought to you by:
samtregar
From: Chris F. <cf...@do...> - 2007-07-26 16:01:59
|
Folks, I'm having (what I hope is) a syntax problem. I'm trying to use the "filter" option to run a sub on a template at create time, but I want the sub in another package and I need to some other objects with it. >From reading the docs I thought that the HTML::Template object would simply be the first incoming param, but its not. For example, here is how I wanted to create my template object: my $template_header = new HTML::Template(filename => 'CommonHeader.tmpl', filter => { sub => scripts::MyPackage->initialize_template_header($r,$db,$site_settings,$user_s ession_data,\%form_data) }, ); Then in "MyPackage.pm", I would have sub initialize_template_header { my ($self,$template,$r,$db,$site_settings,$user_session_data,$form_data) = @_; .... } $self is correctly defined, but $template becomes the first object I send in ($r in this case). How do I get the HTML::Template object?? TIA!! -Chris |