RE: [coldbox:11249] Re: Understanding Helpers and User Defined Functions

In handlers, you can use includeUDF()

As far as my models, my application has a supertype component that everything inherits from where I put some basic stuff like cfscript versions of dump and mail. (I’m still on CF8 as work)

As far as utility functions like formatting and conversion, I keep those in a CFC and either inject a reference to that CFC, or to that method.

I have this dummy CFC that returns references to my UDFs:

<cfreturn variables[MissingMethodName]>

When I want a reference to a single method out of my UDF library, I ask wirebox to inject “model:UDF:myUDFName”. That hits the dummy CFC above and returns a reference to that method which gets mixed directly in to my model.

You might not like that, but I thought I would share what we had cooked up at my job. I’ve actually wanted to talk to Luis about an enhancement to WireBox DLS to allow you to request a single method be mixed in in a similar fashion without the need for the dummy CFC above.