Using DUMP Within CFSCRIPT

On December 28, 2007, in ColdFusion, by Anuj Gakhar

I just came across this so I thought I should blog. I always used a custom UDF whenever I had to use dump inside cfscript and because I happen to write most of my code inside CFSCRIPT, I needed it a lot. But Apparently, you can do this as well using the adminapi.

[xml]
<cfscript>
adminapi = createObject("component","cfide.adminapi.security");
myVar = "hello world";
adminapi.dump(myVar);
</cfscript>[/xml]

Update : Looks like the security cfc extends the base cfc so it would be more ideal to do this I guess.

[xml]
<cfscript>
adminapi = createObject("component","cfide.adminapi.base");
myVar = "hello world";
adminapi.dump(myVar);
</cfscript>[/xml]

 

9 Responses to Using DUMP Within CFSCRIPT

  1. Ben Nadel says:

    That’s a pretty cool tip. Thanks.

  2. Anuj Gakhar says:

    Yeah I liked it as well. Looks like this is the only method that doesnt require you to login. All other methods inside the adminapi require you to be logged in. Thats what I found out.

  3. Dav R says:

    Hi Anug,

    Great Tip!.. It even worked when I tried to dump the adminapi variable itselef like this.

    adminapi=CreateObject(“component”,”cfide.adminapi.security”);
    myvar=”Welcome”;
    adminapi.dump(adminapi);

    Cool!.

    Thanks,
    Dav R

  4. Dav R says:

    Sorry.. I should have typed that as “adminapi” object!.

  5. Anuj Gakhar says:

    @Dav, Thats right. DUMP would work on any CF object I guess. Glad you liked it.

  6. David Levin says:

    Wicked. Exactly what I was looking for. Thank you.

  7. JIbu says:

    Thank you, cool and interesting one.

  8. Thanks for the help with that. I’m getting into programming stuff more and more lately so I’m always on the lookout for something that will either save me time or make my life easier.

  9. Thanks for sharing your code snippets since this would certainly help me with some instances. And I have tried to trace and understand the flow of it so that I could modify it and enhance it’s procedures.

Leave a Reply to Dav R Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2011 Anuj Gakhar
%d bloggers like this: