Hey Paul...

Here's the latest test. :) Note that in test.cfc, I've got both
CFINVOKE and createObject() styles of accessing the second CFC... they
both work just fine. I used one, then remarked it out and used the
other too and figured I'd leave them both in as examples.

temp.cfm
-------------------------
<cfdump var="#createObject('component','test').getCGIVar('server_name')#" />
<cfdump var="#createObject('component','test').getCGIVar('')#" />

test.cfc
-------------------------
<cfcomponent>
        <cffunction name="getCGIVar">
                <cfargument name="cgVar" type="string" default="">

                <!---
                <cfset var cVLocal = "">
                <cfinvoke component="test2" method="getCGI"
cV="#arguments['cgVar']#" returnvariable="cVlocal">
                <cfreturn cVlocal />
                --->

                <cfreturn  
createObject("component","test2").getCGI(arguments["cgVar"])/>
        </cffunction>
</cfcomponent>

test2.cfc
-------------------------
<cfcomponent>
        <cfscript>
                function getCGI(cV) {
                                var cVlocal = '';

                                if (len(cV)) {
                                        cVlocal = cgi[cV];
                                } else {
                                        cVlocal = cgi;
                                }
                                
                                return cVlocal;
                        }
        </cfscript>
</cfcomponent>


I think it's worth noting that since test.cfc is calling
test2.getCGI(arguments["cgVar"]) and cgVar is being created in the
cfarguments of test.getCGIVar() with a default value of "", I was able
to dispense with the try/catch and use an if... sort of speaks to
Facade patterns, doesn't it? My need to always supply an empty
argument is hidden by my public API.

Kinda neat.

This was a fun, if simple, excercise... thanks Paul!

Laterz,
J

On Thu, 3 Mar 2005 08:19:29 -0700, Paul <[EMAIL PROTECTED]> wrote:
> Thanks for playing around with this, Jared.
> 
> In your experiments did you try calling test.getCGI() from within a second
> cfc as well?  (temp.cfm creates test1.cfc; test1.cfc calls test.getCGI() as
> part of its processing.)
> 
> If that works for you my difficulty may be a difference between BD and CFMX;
> my life would be simpler if I could talk my way into a second MX license...
> 
> 


-- 
Continuum Media Group LLC
Burnsville, MN 55337
http://www.web-relevant.com
http://cfobjective.neo.servequake.com

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197257
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to