cf_copyUdfs

cf_copyUdfs

Version: 2.0 build 20050812
Requires: Adobe ColdFusion MX 6.0 or greater
Total size: 1.07 KB
Download time: 0.19 seconds at 56kbps
Edition: Freeware

Description

Copy any UDFs defined in the variables scope of the calling page into some other scope or structure. When UDFs are declared, they are placed in the variables scope. This tag is a handy way of shifting them into a more persistent scope such as request or application. If you create a file containing several UDFs, simply place a call to this tag at the bottom of the file, to shift all the declared UDFs into (by default) the request scope.

Result

Copies UDFs into new location.

Category

variable manipulation

Parameters


Parameter Type Required? Default Description
to variableName No request Name of a scope or structure

Custom tag source


 
<!---**
* cf_copyUdfs
* Copy any UDFs defined in the variables scope of the calling page into 
* some other scope or structure. When UDFs are declared, they are placed in
* the variables scope. This tag is a handy way of shifting them into a more
* persistent scope such as request or application.
* 
* @param to               scope or structure (default: request)
* @result Copies UDFs into new location.
* @author Matthew Walker, WWW.eswsoftware.com
* @version 2, 2005-08-12 changed functionality for CFMX7 compatibility
* @version 1, 2004-05-05
*--->

<cfparam name="attributes.to" type="variableName" default="request">
<cfparam name="#attributes.to#" type="struct" default="#structNew()#">	

<cfparam name="request.eswsoftware" default="#structNew()#">
<cfparam name="request.eswsoftware.copyUdfs" default="#structNew()#">
<cfset request.eswsoftware.copyUdfs.version = 2>

<cfset library = evaluate(attributes.to)>
<cfloop collection="#caller#" item="key">
	<cfif isCustomFunction(caller[key])>
		<cfset library[key] = duplicate(caller[key])>
	</cfif>
</cfloop>
User-Defined Functions. UDFs were added to ColdFusion 5 and are usually written using CFScript, but, with the release of ColdFusion MX, may also be written with regular CFML tag-based markup.
World Wide Web