On Mon, 26 Nov 2001, Tatsuhiko Miyagawa wrote:

> How is this going on? Times has persuaded me that this
> implementation is not sufficient, because it processes all
> component handling on filter phase, which seems too early.
>
> How do we pass parameters to component? Like this?
>
>   <TMPL_COMP><TMPL_VAR name="foo"></TMPL_COMP>

I agree - this is a weakness in my original spec.  Maybe something like:

   <tmpl_comp name="Some::Component" args="foo,bar">
     some text args
   </tmpl_comp>

Or if there is no text part:

   <tmpl_comp name="Some::Component" args="foo,bar"/>

Is that just too much XML?  Anyway, the point would be that there would be
needs to be some way to pass arguments from the template to the component.
I this could be done by transforming into HTML::Template::Expr format
instead of HTML::Template.  For example:

   <tmpl_comp name="Some::Component" args="foo,bar">text</tmpl_comp>

Could be translated to:

   <tmpl_var expr="comp('Some::Component', 'text', foo, bar)">

Then HTML::Template::Component would supply an implementation for the
comp() function that would make the actual call at output() time.

> But "Component can have another component inside", which seems
> chicken-egg problem to me. Maybe we should re-consider its API.

That's a much harder problem, but I don't think it's impossible to
address.  Most of the trouble would be in the parser - translation into an
expression should be possible even for nested calls.

-sam



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to