Well, since you asked -- I almost always object to seeing "evaluate" -- it's unnecessary in almost all cases and can have non-trivial performance cost.

Whether the method I suggested in my earlier email for dynamically calling a CFC method inside CFSCRIPT is "better" I'll leave up to the reader ;)



Lee Howard wrote:
If you are using cfscript and need to dynamically call method you
could use something like this:

obj_myobj = createobject("component","myobj").init();
result = evaluate("obj_myobj.#methodName#(parameters)");

I didn't test this, but it should work. Any objections?
Lee

On 8/25/05, Peter J. Farrell <[EMAIL PROTECTED]> wrote:

[EMAIL PROTECTED] wrote:


One reason to do <cfinvoke> over createobject is you can dynamically
call different methods.  I do not think you can do this with
createobject.



You are correct Tom...


<cfparam name="attributes.method" default="getFoo">

<cfinvoke component="SomePackage.SomeCFC"
     method="#attributes.method#"
     returnvariable="variables.BaddaBing">
</cfinvoke>

I have had to use this occasionally.  I prefer working with CFC
instances inside <cfscript> though.

Tom



I tend to use createObject unless I have to dynamically call different
methods.

--
Peter J. Farrell :: Maestro Publishing

blog    :: http://blog.maestropublishing.com
email   :: [EMAIL PROTECTED]
phone   :: 651-204-0513
________________________________
R O O I B O S  G E N E R A T O R...
Create boilerplate beans and transfer objects for ColdFusion!
Rooibos is free to use at: http://rooibos.maestropublishing.com/
________________________________
Member of Team Mach-II - The next rev is coming...



----------------------------------------------------------
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).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

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






----------------------------------------------------------
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).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

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




----------------------------------------------------------
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).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

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


Reply via email to