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... -----Original Message----- From: Jared Rypka-Hauer - CMG, LLC [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 02, 2005 10:20 PM To: CF-Talk Subject: Re: cfscript functions in CFCs This also works: test.cfc ----------------- <cfcomponent> <cfscript> function getCGI(cV) { try { return cgi[cV]; } catch (any cfScriptError) { return cgi; } } </cfscript> </cfcomponent> temp.cfm -------------------- <cfdump var="#createObject('component','test').getCGI('server_name')#" /> <cfdump var="#createObject('component','test').getCGI('')#" /> The first one outputs "w2ksrv1" which is the server name of my dev box. The second one does a cfdump of the CGI struct. I was messing around with using various if statements to detect cV, and the try/catch worked immediately. structKeyExists always recognized that cV existed, even when it wasn't passed in. len(cV) threw an error because it tried to access a variable that hadn't been set. I haven't worked with function definitions in cfscript enough to be sure exactly the best way to declare a default value for one... but that snippet ran just fine. Laterz, J ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197242 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=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

