Hi-

Is it better to use cfinvoke to dynamically call a method on a CFC or to use
the Evaluate() function?

E.g.

Approach A:

<cfset obj = CreateObject('component', 'foobar').init()>
<cfset FunctioName = "getName">
<cfset foo = Evaluate("obj.#FunctionName#()")>

-- OR --

Approach B:

<cfset FunctioName = "getName">
<cfinvoke component="foobar" method=#FunctionName# returnvariable="foo" />

Other than that Approach A takes an extra line to instantiate the object, is
it better overall to use cfinvoke? One advantage that Approach A has for our
needs is that we are potentially running this in a loop, so we can create
the object once and then put it in a cache struct and re-use it in a
subsequent loop call, whereas cfinvoke just calls it in a one-off fashion.

Any ideas? (Dont say use ColdSpring...)

Thanks
/Cody




----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]


Reply via email to