in reply to Template::Toolkit and foreign classes ?

Did you say "use" or "USE"? TT keywords are case sensitive.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on Re: Template::Toolkit and foreign classes ?

Replies are listed 'Best First'.
Re^2: Template::Toolkit and foreign classes ?
by bugsbunny (Scribe) on Feb 06, 2005 at 22:44 UTC
    my stupid mistake,
    Now I get :
    plugin error - My::Blahcreate needs a hashref at /usr/lib/perl5/vendor +_perl/5.8.2/i686-linux/Template/Plugins.pm line 119
    hmm, thinking....i now wonder that i have to do it other way...or something like that I cant figure out what is the right approach to my problem..

    I have subclassed Class::DBI. In these subclases I created some methods like the shown above.
    On the other hand I made a View-object which use Template toolkit to do the HTML rendering.
    So now I want to access Class::DBI-subclasses methods from within the templates.
    This way baypassing data "retransmission" in my asp (ASP.pm) scipts. Here is snippet of example asp script :
    my $model = $class->retrieve_all(); $view->variables(data => $model, id => $Request->Params('id') ); $view->variables(list_columns => [ $class->cols('list') ] );

    I want to not use the last line, but have the ability to call them directly in the template.
    I'm also wondering 'cause this in some sense will break MVC approach, but on other hand these are just 'informational' methods (i.e. i do not plan yet :")) to do some html-rendering there..

    what is your advise ? PS.
    |<? FOR name = data.cols('list')?> <?name ?> <?END?>|
    doesnt seem to do it. Do I do something very stupid here or this is just my feeling :")