Now, this looks academic. What would be the use of knowing the name of
variable that stores the memory location of the object's invocation?
Teddy
On 12/8/06, Sammy Larbi <[EMAIL PROTECTED]> wrote:
Actually, this is quite a bit easier that I thought. This function
will output the names of all the variables (I think) that reference your
component, given a scope. I got the idea for inserting a UUID from
looking at cfcUnit, so I gotta give credit there. Of course, it will
need to be in your component.
<cffunction name="getTheNameOfTheVariableThatContainsMe" output="true">
<cfargument name="variablesScope" required="true">
<cfset this.testkey = createUUID()>
<cfloop list="#structkeylist(variablesScope)#" index="name">
<cfif isStruct(variablesScope[name]) and
structKeyExists(variablesScope[name],"testKey") and
variablesScope[name].testKey eq this.testKey>
#name#,
</cfif>
</cfloop>
<cfset structDelete(this,"testKey")>
</cffunction>
Ed Griffiths wrote, On 12/8/2006 8:40 AM:
> Hi
>
> Quick question. If you store an object in a variable like this:
>
> <cfset myObject = createObject("component","testObject").init()>
>
> Is it possible to interrogate some method or metadata associated with
> testObject in order to find out what variable name it has been stored
within
> (myObject in this case)?
>
> Thanks for your help,
> Ed
>
>
>
>
> You are subscribed to cfcdev. To unsubscribe, please follow the
instructions at http://www.cfczone.org/listserv.cfm
>
> CFCDev is supported by:
> Katapult Media, Inc.
> We are cool code geeks looking for fun projects to rock!
> www.katapultmedia.com
>
> An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]
>
>
>
>
You are subscribed to cfcdev. To unsubscribe, please follow the
instructions at http://www.cfczone.org/listserv.cfm
CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]
--
<cf_payne />
Adobe Certified ColdFusion MX 7 Developer
Atlanta CFUG (ACFUG): http://www.acfug.org
You are subscribed to cfcdev. To unsubscribe, please follow the instructions at
http://www.cfczone.org/listserv.cfm
CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]