House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Search cf-talk

July 04, 2009

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Home /  Groups /  ColdFusion Talk (CF-Talk)

debugging in cfscript

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Richard White
05/20/2008 01:17 PM

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

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Aaron Rouse
05/20/2008 01:20 PM

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 -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Charlie Griefer
05/20/2008 01:21 PM

<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 -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dominic Watson
05/20/2008 01:25 PM

> 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

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Richard White
05/20/2008 01:33 PM

thanks guys, very neat solution :)


<< Previous Thread Today's Threads Next Thread >>

Mailing Lists