in order to write or read to and from the application scope, you must use
the prefix.  placing a cfset in an application.cfm file creates an
"application level" variable, meaning a variable that will be created on
every request that processes the application.cfm template, but it does not
write the variable to the application scope unless you specify the prefix
when cfsetting the variable.  A variable created without a prefix, but in
the application.cfm file, is written to the local scope ("variables" scope).

~Simon

> Simon Horwith
> Allaire Certified ColdFusion Instructor
> Certified ColdFusion Developer
> Fig Leaf Software
> 1400 16th St NW, # 220
> Washington DC 20036
> 202.797.6570 (direct line)
> www.figleaf.com
> 


-----Original Message-----
From: Evan Lavidor [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 13, 2001 4:11 PM
To: CF-Talk
Subject: what happens when you don't scope a variable?


I've recently been looking at someone else's code that's been handed to me,
and came across the following question...

In my templates, I've got my constants set as Request variables
(Request.DSN, for example) in application.cfm and I reference them that way.
I used to have a bunch of application variables (e.g. application.dsn) but
changed this to prevent the need for locking these values.

However, the code I was looking at had a bunch of unscoped variables in
application.cfm (<cfset DSN = "datasourcename">).

So, to finally get to the question: if that's done, is the variable
automatically treated as an application scoped variable, since it's set in
application.cfm?  Or, is the var only an application variable if it is
scoped as such, and, since it isn't scoped, it's treated as a local variable
(of the variables. scope but without the scope)?

If the latter is true, then no problem.  However, if the former is true,
then there are some definite locking issues with the code I'm looking at.

Thanks,

Evan

--
-=-=-=-=-=-=-=-=-=-
Evan Lavidor
Circle.com Boston
Tel: 617-585-3107
Fax: 617-585-3091
-=-=-=-=-=-=-=-=-=-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to