|
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
debugging in cfscript
hi,Richard White 05/20/08 01:17 P Depending on where you are in the script it could be as simple as ending theAaron Rouse 05/20/08 01:20 P <cffunction name="cf_abort" output="false" returntype="void">Charlie Griefer 05/20/08 01:21 P > when debugging with coldfusion tags i use the cfoutput and cfdump tags alot but how can i use these tags and the cfabort tag within cfscript, or how can i get the > same effect as these tags? A common practice is to create a udf that wraps the functionality of a cf tag, so:Dominic Watson 05/20/08 01:25 P thanks guys, very neat solution :)Richard White 05/20/08 01:33 P hi, when debugging with coldfusion tags i use the cfoutput and cfdump tags alot but how can i use these tags and the cfabort tag within cfscript, or how can i get the same effect as these tags? thanks richard Depending on where you are in the script it could be as simple as ending the cfscript then putting in a cfdump and then beginning the cfscript again. I often debug small problems within cfscripts by using writeoutput functions for the values on if statements and other things of that nature. I suppose you could create a function that simple dumps out whatever you fed it so that you could put inline dumps. ----- Excess quoted text cut - see Original Post for more ----- <cffunction name="cf_abort" output="false" returntype="void"> <cfabort /> </cffunction> <cffunction name="cf_dump" output="false" returntype="void"> <cfargument name="objToDump" type="any" required="false" default="" /> <cfdump var="#arguments.objToDump#" /> </cffunction> <cfscript> var myArray = newArray(1); myArray[1] = "Larry"; myArray[2] = "Moe"; myArray[3] = "Curly"; cf_dump(myArray); cf_abort; </cfscript> ----- Excess quoted text cut - see Original Post for more ----- > when debugging with coldfusion tags i use the cfoutput and cfdump tags alot but how can i use these tags and the cfabort tag within cfscript, or how can i get the > same effect as these tags? A common practice is to create a udf that wraps the functionality of a cf tag, so: <cffunction name="dump"> <cfargument name="var" type="any" required="true"> <cfargument name="expand" type="boolean" required="false" default="true"> <cfargument name="label" type="string" required="false" default=""> <cfdump var="#arguments.var#" expand="#arguments.expand#" label="#arguments.label#"> </cffunction> <cfscript> aArray = ArrayNew(1); aArray[3] = 'fooey'; dump(aArray); </cfscript> Dominic -- Blog it up: http://fusion.dominicwatson.co.uk thanks guys, very neat solution :)
|
Mailing Lists
|
Latest Fusion Authority Articles
|
||||||