Dumping and aborting with <cfscript>

One of the annoying things about cfscript is it’s lack of support for a lot of CFML tags.

<cfdump> and <cfabort> are 2 tags I always use in development, especially for debugging. A way to use this functionality is to create a UDF to do these types of functions.

For example

<cffunction name="dump" access="public" output="true" returntype="struct">
    <cfargument name="arg" />
    <cfdump var="#arg#" />
</cffunction>

<cffunction name="abort" access="public" output="false" returntype="void">
    <cfabort />
</cffunction>

This function can be stored in a simple utilities component and stored in application scope, that way you can call it from anywhere.

Post a Comment or Leave a Trackback

One Comment

  1. April 7, 2010 at 4:23 pm | Permalink

    Another way to dump inside a cfscript block is:

    CreateObject(“component”, “cfide.adminapi.base”).dump(yourVariable);

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*