Peter,
Assuming I understand your question, I can see two approaches.
1) Give up cfscript and use cfinvoke (far more flexible for this sort
of thing).
2) Create function or method that uses cfinvoke to call a generic
component and method with specified arguments.
For example:
<cffunction name="MethodCall" access="public" returntype="any">
<cfargument name="component" type="any" required="yes">
<cfargument name="method" type="string" required="yes">
<cfargument name="args" type="struct" required="no">
<cfset var result = 0>
<cfif StructKeyExists(arguments,"args")>
<cfinvoke
component="#arguments.component#"
method="#arguments.method#"
returnvariable="result"
argumentcollection="#arguments.args#">
</cfinvoke>
<cfelse>
<cfinvoke
component="#arguments.component#"
method="#arguments.method#"
returnvariable="result">
</cfinvoke>
</cfif>
<cfreturn result>
</cffunction>
Then, instead of this:
Local.LoopReturns =
evaluate("Request.#Local.Temp.Class#.#Local.Temp.Method#(Local.Temp.Parameters)"
have this:
Local.LoopReturns =
MethodCall(Request[Local.Temp.Class],Local.Temp.Method,Local.Temp.Parameters);
Of course, Local.Temp.Parameters would now have to be a structure
instead of a comma-delimited list.
Make sense?
Or did I misunderstand your problem?
Steve Bryant
918-449-9440
Bryant Web Consulting LLC
http://www.BryantWebConsulting.com/
http://steve.coldfusionjournal.com/
At 09:01 AM 6/8/2006, Peter Bell wrote:
Hi There,
Reforming evaluator needs assistance *grin*. I have a loop that
generically makes n-function calls which are pulled from a database
table. Each function call can be to a different method of a
different service using n-different parameters . I'm within a
cfscript block and loathe to go back to regular cf syntax. How do I
do the following without my (nasty!) evaluate?
Local.TempReturns =
evaluate("Request.#Local.Temp.Class#.#Local.Temp.Method#(Local.Temp.Parameters)");
If it helps, the context is:
Local.LoopCount = 1;
Local.LoopError = 0;
Do
{
Local.Temp.Step = ListGetAt(Local.ProvisionerStepList,Local.LoopCount);
Local.Temp.Class = Local.Parameters[Local.Temp.Step].Class;
Local.Temp.Method = Local.Parameters[Local.Temp.Step].Method;
Local.Temp.Parameters = Local.Parameters[Local.Temp.Step].Parameters;
Local.LoopReturns =
evaluate("Request.#Local.Temp.Class#.#Local.Temp.Method#(Local.Temp.Parameters)");
Local.LoopError = Local.LoopReturns.Status;
ReturnStruct.Message = ReturnStruct.Message & "<br>" &
Local.LoopReturns.StatusMessage;
Local.LoopCount = Local.LoopCount + 1;
}
While (Local.LoopCount LTE ListLen(Local.ProvisionerStepList) AND
NOT Local.LoopError);
The problem I'm solving is the ability to call n-provisioning steps
pulled from a database so I can allow a non-technical user to modify
the provisioners they want run, with a catch that every provisioner
returns status and no more provisioners should be run on any one of
the provisioner calls failing.
Any help much appreciated!
Best WIshes,
Peter
----------------------------------------------------------
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]
----------------------------------------------------------
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]