Listing 1

<cfobject type="component" name="testObj" component="test">

<!--- A small chain of CFC function calls --->
<cfset backwardsPhrase = testObj.reversePhrase(testObj.getPhrase())>

<cfdump var="#backwardsPhrase#">


Listing 2

<cfcomponent displayname="test" extends="application">

	<cffunction name="getPhrase" access="public" output="false" returntype="string">
		<cfargument name="phraseNumber" type="numeric" required="no"
		 default="#randRange(0,10)#">

		<cfset var stackLevel = super.onCall("test.cfc","getPhrase",arguments)>

			<cfswitch expression="#arguments.phraseNumber#">
				<cfcase value="0"><cfset phrase = "hero to ZERO"></cfcase>
				<cfcase value="1"><cfset phrase = "your number ONE"></cfcase>
				<cfcase value="2"><cfset phrase = "number TWO is the loneliest number
				 since the number one"></cfcase>
				<cfcase value="3"><cfset phrase = "THREE is a crowd"></cfcase>
				<cfcase value="4"><cfset phrase = "FOUR score and seven years
				 ago"></cfcase>
				<cfcase value="5"><cfset phrase = "johny FIVE alive"></cfcase>
				<cfcase value="6"><cfset phrase = "alfonseca has SIX
				 fingers"></cfcase>
				<cfcase value="7"><cfset phrase = "SEVEN days a week"></cfcase>
				<cfcase value="8"><cfset phrase = "i EIGHT it"></cfcase>
				<cfcase value="9"><cfset phrase = "did I hear a NINEr in
				 there"></cfcase>
				<cfcase value="10"><cfset phrase = "TENteen"></cfcase>
				<cfdefaultcase><cfset phrase = "Opps, No Phrase"></cfdefaultcase>
			</cfswitch>

		<cfreturn super.onReturn(phrase, stackLevel)>
	</cffunction>

	<cffunction name="reversePhrase" access="public" output="false" returntype="string">
		<cfargument name="phrase" type="string" required="yes">

		<cfset var rev = "">
		<cfset var stackLevel = super.onCall("test.cfc","reversePhrase",arguments)>

		<cfloop index="i" from="1" to="5" step="1">
			<cfset rev = reverse(this.getPhrase())>
		</cfloop>

		<cfreturn super.onReturn(rev, stackLevel)>
	</cffunction>
</cfcomponent>


Listing 3

<cfcomponent displayname="application">
	<cffunction name="onRequestStart" access="public" output="false" returntype="void">
		<cfset request.cfcStack = arrayNew(1)>
	</cffunction>

	<cffunction name="onRequestEnd" access="public" output="true" returntype="void">
		<cfif isDebugMode() EQ true>
			<cfdump var="#request.cfcStack#">
		</cfif>
	</cffunction>

	<cffunction name="onError" access="public" output="true" returntype="void">
		<cfargument name="exception" type="any" required="yes">
		<cfargument name="eventName" type="String" required="yes">

			<cfmail to="nik@trueTechnology.com" from="nik@trueTechnology.com"
			 subject="Error!" type="html">
				<cfdump var="#request.cfcStack#">
				<cfdump var="#arguments.exception#">
				<cfdump var="#arguments.eventName#">
			</cfmail>

			<cfif isDebugMode() EQ true>
				<cfthrow object="#arguments.exception#">
			</cfif>
	</cffunction>

	<cffunction name="onCall" access="public" output="false" returntype="numeric">
		<cfargument name="componentName" type="string" required="yes">
		<cfargument name="functionName" type="string" required="yes">
		<cfargument name="argumentsCollection" type="struct" required="yes">

			<cfset var newCfcCall = structNew()>

			<cfset structInsert(newCfcCall,"component",arguments.componentName)>
			<cfset structInsert(newCfcCall,"function",arguments.functionName)>
			<cfset structInsert(newCfcCall,"arguments",arguments.argumentsCollection)>
			<cfset structInsert(newCfcCall,"start",getTickCount())>

			<cfset arrayAppend(request.cfcStack,newCfcCall)>

		<cfreturn arrayLen(request.cfcStack)>
	</cffunction>

	<cffunction name="onReturn" access="public" output="false" returntype="any">
		<cfargument name="returnValue" type="any" required="yes">
		<cfargument name="stackLevel" type="numeric" required="no"
		 default="#arrayLen(request.cfcStack)#">

		<cfset editStruct = request.cfcStack[arguments.stackLevel]>
		<cfset structInsert(editStruct,"results",arguments.returnValue)>
		<cfset structInsert(editStruct,"end",getTickCount())>
		<cfset structInsert(editStruct,"length",editStruct.end-editStruct.start)>

		<cfreturn arguments.returnValue>
	</cffunction>
</cfcomponent>