Ok now I understand what you have done... I tought that I will know who hasUsing the same technique I have created the following example CFC that now returns an array of methods. The array will contain all methods in the stack that were used to call the final method with my code in it. Further, the array is ordered equivalent to the order in which the methods appeared on the stack i.e. array[1] is the last method called.
called the method... because right now, on all my methods I have the first
arguments wich is .. <cfargument name="in_callername ... ">.... on every
method I have this first argument.... just to know who has called the
method... for debugging purposes... If I could use your code to know whose
calling... I will not need this argument on every method...
<cfcomponent>
<cffunction name="getCaller" returntype="array" access="public">
<cfscript>
e = CreateObject("java", "java.lang.Exception");
sts = e.getStackTrace();
methodStack = "";
for(itr = 1; itr lte ArrayLen(sts); itr = itr + 1) {
className = sts[itr].getClassName();
if(className contains "2ecfc") {
methodName = sts[itr].getClassName();
index = Find("$func", methodName);
if(Len(methodStack) eq 0)
methodStack = Mid(methodName, index + 5, Len(methodName));
else
methodStack = methodStack & "," & Mid(methodName, index + 5, Len(methodName));
}
}
</cfscript>
<cfreturn ListToArray(methodStack)>
</cffunction>
<cffunction name="foo" returntype="array" access="public">
<cfreturn getCaller()>
</cffunction>
<cffunction name="bar" returntype="array" access="public">
<cfreturn foo()>
</cffunction>
</cfcomponent>
Matt Liotta President & CEO Montara Software, Inc. http://www.MontaraSoftware.com (888) 408-0900 x901
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
