Copy link to clipboard
Copied
Hello, all,
I'm working on some legacy code that I inherited from a long-gone developer (he left about two years ago.)
For some reason, the developer is setting application variables in the onRequestStart() section of application.cfc.
I was under the impression that application variables were set when the server is first started, or comes back from a reboot, or similar situation. Yet until recently, this application was running without a hitch.
Am I crazy? Obviously the variables are working, but I didn't think it would.
V/r,
^_^
Copy link to clipboard
Copied
Application variables can be set anywhere in your application, including in .CFM files. You might be thinking of the this scope in Application.cfc, which can only be set in the pseudo-constructor portion of Application.cfc.
Copy link to clipboard
Copied
Hi, Carl,
Okay. I just thought that anything set in the application scope would be ignored unless/until a reboot or reinit. I just never saw anyone set application variables like that, before. But, if it works..
V/r,
^_^
Copy link to clipboard
Copied
I recommend that you read the Developing CFML Applications -> About Applications section of the "Developing ColdFusion Applications" document linked on the ColdFusion Help page. It contains important concepts that you need to understand about the application scope.
Cheers
Eddie
Copy link to clipboard
Copied
P.S. To answer your question, yes, you're crazy.
Cheers
Eddie