All you need to do is drop the COMPONENT="this" from the calls and it'll all
work fine.

<CFCOMPONENT>
        <CFFUNCTION NAME="PublicMethod" RETURNTYPE="numeric"
ACCESS="public">
                <CFSET var x = "">

                <CFINVOKE METHOD="PrivateMethod" RETURNVARIABLE="x"/>
                
                <CFRETURN x/>
        </CFFUNCTION>
        
        <CFFUNCTION NAME="PrivateMethod" RETURNTYPE="numeric"
ACCESS="private">
        
                <CFRETURN 10/>
        </CFFUNCTION>
</CFCOMPONENT>

Roland

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Brian Kotek
Sent: Wednesday, January 26, 2005 12:35 PM
To: [email protected]
Subject: RE: [CFCDev] CFC method access

He's trying to call the method name dynamically, which you can't do like
that. But I agree, I think it's not possible to call a private method on
#this# from within the same CFC (which could/should probably be
construed as a bug).


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf
> Of Joe Rinehart
> Sent: Wednesday, January 26, 2005 11:50 AM
> To: [email protected]
> Subject: Re: [CFCDev] CFC method access
> 
> afaik, the "this" scope is the "public" interface to the element, so
> it'd deny any requests going through it.
> 
> why not just use:
> 
> 
> <cffunction name="mainmethod" output="false" returntype="string"
> access="public">
>        <cfset var ret = privateMethod()>
>        <cfreturn ret />
> </cffunction>
> 
> On Wed, 26 Jan 2005 11:14:50 -0500, Qasim Rasheed
> <[EMAIL PROTECTED]> wrote:
> > Hi everyone,
> >
> > I am having some problem with the access method of a CFC and I was
> > wondering if someone could lend some help.
> >
> > Here is my CFC
> >
> > <!--- Test.cfc ---->
> > <cfcomponent>
> > <cffunction name="init" access="public" returntype="test">
> >         <cfreturn this />
> > </cffunction>
> > <cffunction name="mainmethod" output="false" returntype="string"
> > access="public">
> >         <cfset var ret = "">
> >         <cfinvoke component="#this#" method="packageMethod"
> returnvariable="ret" />
> >         <!---
> >                 this doesn't work
> >         <cfinvoke component="#this#" method="privateMethod"
> > returnvariable="ret" /> --->
> >         <cfreturn ret />
> > </cffunction>
> > <cffunction name="privateMethod" access="private"
returntype="string">
> >         <cfreturn "Private Method" />
> > </cffunction>
> > <cffunction name="packageMethod" access="package"
returntype="string">
> >         <cfreturn "Package Method" />
> > </cffunction>
> > </cfcomponent>
> >
> > As you can see when I try calling a private method by using "this",
it
> > won't work however it works fine for a package method. Any thought?
> >
> > Thanks
> >
> > Qasim
> > ----------------------------------------------------------
> > You are subscribed to cfcdev. To unsubscribe, send an email
> > to [EMAIL PROTECTED] with the words '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]
> >
> 
> 
> --
> For Tabs, Trees, and more, use the jComponents:
> http://clearsoftware.net/client/jComponents.cfm
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the words '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]

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words '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]



----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words '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]

Reply via email to