> (My CFCs store metadata about themselves - if they're called in an
> application they store it the application scope, if they're called outside
> of an application they store it in the server scope.)
Why don't they store it in their 'variables' scope, so it's internal?
That way the burden of picking the right scope to store the info in
rests solely on the shoulders of the app developer, who will know
whether application or server is more appropriate.
cheers,
barneyb
On Fri, 18 Mar 2005 13:47:35 -0500, Jim Davis
<[EMAIL PROTECTED]> wrote:
> I've got the following method in my root CFC:
>
> <cffunction name="isApplication"
> hint="Returns true if the application scope has been
> instantiated."
> returntype="boolean"
> access="public"
> output="No">
>
> <!--- Try the app --->
> <cfif IsDefined("Application")>
> <cfreturn true />
> <cfelse>
> <cfreturn false />
> </cfif>
>
> </cffunction>
>
> It seems to work pretty well, but every once in a while I'm getting odd
> results.
>
> I've also tried:
>
> <cffunction name="isApplication"
> hint="Returns true if the application scope has been
> instantiated."
> returntype="boolean"
> access="public"
> output="No">
> <!--- Set Local Scope --->
> <cfset var local = StructNew() />
>
> <cftry>
> <cfset
> application.SomeReallyLongVariableNameThatWontBeUsedElsewhere = true />
> <cfcatch type="any">
> <cfreturn false />
> </cfcatch>
> </cftry>
>
> </cffunction>
>
> But this has also been a little flakey (and seems like it would have more
> overhead for having to generate an error instance).
>
> Basically I'm looking for the fastest, best way to do this.
>
> (My CFCs store metadata about themselves - if they're called in an
> application they store it the application scope, if they're called outside
> of an application they store it in the server scope.)
>
> Jim Davis
--
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/
Got Gmail? I have 50 invites.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:199386
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