|
|
| go ahead... be a heretic | |
| PerlMonks |
Catalyst::VIew::TT - format an objectby tospo (Friar) |
| on Jun 27, 2011 at 16:04 UTC ( #911574=perlquestion: print w/ replies, xml ) | Need Help?? |
|
tospo has asked for the
wisdom of the Perl Monks concerning the following question:
I'm stuck with the following problem at the moment: where $c->stash->{bio_seq} was populated with a Bio::Seq object in the controller. So far so good... What I would now want to do is to use the information that comes with the Bio::Seq object to render a more informative version of it, which should use styles to highlight some sequence features. Basically, I would like a view helper method that takes the Bio::Seq object as an argument and returns a snippet of HTML with the sequence and style information to insert into the view.
I know how to use TT FILTERs but they wouldn't work with the object, so I found the 'expose_methods' config option in Catalyst::View::TT, which sound like just the ticket but I'm not having any luck with it. In MyApp::View::TT (just a silly example that would return a static text just to see if it works) And in the template file that is rendered in the end: But colorised_seq_features simply renders nothing and there is no error message either (I did turn on DEBUG in the View::TT config). I tried to use a method name that definitely doesn't exist and the view still doesn't complain, so I'm not sure where thie is going wrong. Does anybody have any experience with expose_methods? The documentation is very short and I can't find much else about it. I have used similar techniques (view helpers) in Ruby on Rails and I was hoping to use the same technique in Catalyst. Am I completely on the wrong tracks (excuse the pun...)? I should also mention that I could of course do all of this in the controller and populate the stash with a HTML snippet but I would like to use the same technique in different views and I really think that the controller shouldn't provide HTML snippets and let the view sort that out. Thanks for your help!
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||