in reply to Forcing context of dot operator in Template Toolkit

Contextual::Return does one kind of magic. Template Toolkit is a different kind of magic. The magic overlaps. The magic goes Boom, and fails.

Seriously, the problem is that C::R returns a highly overloaded singleton object to "sense" the right context, which fails in TT because TT has its own simple probes for "is this an object? Yes, call a method. No, well is it a hash ref then?" and so on.

You're unlikely to get them to play together. You'll need to build a Perl shim that you can insert between the thing that returns a C::R object and that TT can actually call. Sorry about that.

  • Comment on Re: Forcing context of dot operator in Template Toolkit

Replies are listed 'Best First'.
Re^2: Forcing context of dot operator in Template Toolkit
by agianni (Hermit) on Oct 24, 2007 at 16:36 UTC
    'kay, that's what I thought. Reminds me of a little experiment I did a while ago, letting Eliza talk to herself:
    Eliza1: Hi. I'm Eliza. Tell me your problems! Eliza2: How long are you Eliza Tell you my problems? Eliza1: Why are you so interested wether I am Eliza Tell me your probl +ems or not? Eliza2: Why are you so interested wether I am so interested wether you + are Eliza Tell you my problems or not or not? Eliza1: Why do you think that I am Eliza Tell me your problems or not +or not? Eliza2: You say that you are Eliza Tell you my problems or not or not +- do you come therefore? Eliza1: Do you believe that I am Eliza Tell me your problems or not or + not - do me come therefore? Eliza2: You think that you are Eliza Tell you my problems or not or no +t - do you come therefore - Is this normal? Eliza1: Perhaps you would like to be Eliza Tell me your problems or no +t or not - do me come therefore - Is this normal? Eliza2: I think that you aren't sure. Eliza1: Do you really think so? Eliza2: What does this mean for you, saying " Do me really think so "? Eliza1: Why do you ask? Eliza2: Is this question interesting for you? Eliza1: Perhaps you would like to talk about a problem? Eliza2: Why are you so unsteadily? Eliza1: Would you prefer it, if i were so unsteadily? Eliza2: I understand!

    You understand!?!?!

    perl -e 'split//,q{john hurl, pest caretaker}and(map{print @_[$_]}(joi +n(q{},map{sprintf(qq{%010u},$_)}(2**2*307*4993,5*101*641*5261,7*59*79 +*36997,13*17*71*45131,3**2*67*89*167*181))=~/\d{2}/g));'