On Sun, 11 Feb 2007 00:56:17 +0100
Robin Smidsrød <[EMAIL PROTECTED]> wrote:

> One a sidenote, is there some way for an object method to know if it is 
> being called from a template (instead of from normal perl code)? Is 
> there some variable that is set that the function has access to which is 
> not set otherwise? Or can I use some kind of function (caller) to 
> inspect the call stack to figure it out?

Try something like

  if( caller =~ m/Template::/ or not wantarray ) {
    return \%hash;
  }
  else {
    return %hash;
  }

-- 
Paul "LeoNerd" Evans

[EMAIL PROTECTED]
ICQ# 4135350       |  Registered Linux# 179460
http://www.leonerd.org.uk/

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to