A few weeks ago I posted a simple guide to dealing with features you could not use in ColdFusion 9 script based code. While CF9 went a long way to making the scripting form more powerful, there are still some holes that need patching. One of the things that can be a bit confusing though is figuring out all the new script based forms of tags we've used in the past. While not a deep dive, I decided to write up a quick template that ran through all of these new keywords just so I'd have the syntax handy. I hope this helps.
Doing a dump...<cfscript> writedump(var=server,top=2,label="You betcha"); </cfscript>
Doing an include...<cfscript> include "foo.cfm"; //a dynamic version... x = "test2.cfm"; include x; </cfscript>
Doing a cflocation...<cfscript> location(url="test2.cfm",addtoken=false); </cfscript>
cfparam<cfscript> param name="y" default=1 min=1; writeOutput("y is " & y); </cfscript>
Doing a lock...<cfscript> lock type="exlcusive" name="somelock" timeout="30" { //stuff } </cfscript>
Doing a log...<cfscript> writelog(file="application", text="beer time?"); </cfscript>
Doing cfsavecontent...<cfscript> savecontent variable="buffer" { include "test2.cfm"; } </cfscript>
Exception handling...<cfscript> try { writeoutput("unknown #variablename#"); } catch(any e) { //if(e.errnumber == 0) rethrow; writedump(var=e); } finally { writeoutput("<p>finally...."); } </cfscript>
Tracing...<cfscript> trace(category="beer",text="my trace"); </cfscript>
Threading...<cfscript> thread name="slowthing" priority="low" { sleep(1000); } </cfscript>
transactions...<cfscript> transaction action="begin" {
//query
} </cfscript>
Throwing an exception...<cfscript> throw(message="You smell", detail="No, you REALLY smell"); </cfscript>
Stopping the execution of a request<cfscript> abort; </cfscript>
I think that covers everything, but if I missed something, let me know.
Shoot - one more just occurred to me. You can set pagencoding for a CFC at the top of the file - but after the component begins, ala:
component car { pageencoding "Cp1252" }
I've yet to use that syntax.