[Catalyst] calling a method or sub from the View

Ascii King tech at swattermatter.com
Wed Dec 10 22:08:34 GMT 2008


I see now that it isn't a Perl or Catalyst function I need, but a Template
Toolkit macro.  I have it now and i will just keep reading. I apologize for
wasting your time.


Ascii King wrote:
> 
> How can I call a method or sub routine that I create? I simply want to put
> the word 'select' into the html file so the drop down list has the right
> option selected. I determine the right option by pulling it out of the
> database.
> 
> I am new to Catalyst and not very good at Perl. I have searched the web
> for this answer but it eludes me. I know it is simple and I am embarrassed
> by it.  I expect that I create a sub in my controller file (prior.pm it is
> called) and then I call it from within my template. I apologize if I am
> messing these terms up. Here is what I want to do.
> 
> In prior.pm:
> 
> sub isAppointment_Verbal : Local {
> 	my ($self, $c) = @_;
> 	print "checked";
> }
> 
> Then, in the template 'testprior.tt2' I call it like this:
> <input type="radio" value="Verbal" [% isAppointment_Verbal() %]
> name="Confirmation">
> 
> Even with this simplified example I can't get any results at all. What's
> more is I don't know if this is supposed to be handled by the TTSite or
> Perl or Catalyst or what. I have purchased the Catalyst book and I am
> willing to read whatever you point me at, as well.
> 

-- 
View this message in context: http://www.nabble.com/calling-a-method-or-sub-from-the-View-tp20923733p20945116.html
Sent from the Catalyst Web Framework mailing list archive at Nabble.com.




More information about the Catalyst mailing list