Interesting Caller scope situation…

Hit this one the other day, and thought it was rather cute, because I hadn’t even thought of it – even though it makes sense.

If you do a cfmodule call inside a CFC, the caller scope refers to the CFC itself.

This kinda took me aback, because I’m so used to calling a cfmodule from another cfm page, that it was an immediate assumption the caller would be a cfm page.

But if you think about it – the caller scope, just refers to the place that calls the cfmodule – so really it makes alot of sense.

(That and if you look at the underlying code structure, you can see that a cfm page and cfc both extend the same base class, so it’s not totally weird).

Just thought it was cute, so I would share.

Leave a Comment