> Is it safe to call cfmodule from within a CFC stored in the 
> application scope? I think the example below is safe because 
> the custom tag only manipulates the caller's var scope. Can 
> anybody see any other problems?
> 
> <!--- MyComponent.cfc --->
> <cfcomponent>
>       <cffunction name="init" access="public" output="true" 
> returntype="MyComponent">
>               <cfreturn this/>
>       </cffunction>
>       
>       <cffunction name="runCustomTag" returntype="date" output="true">
>               <cfset var tagOutput = ""/>
>               <cfmodule template="MyCustomTag.cfm" 
> outputVariable="tagOutput" />
>               <cfreturn tagOutput/>
>       </cffunction>
> </cfcomponent>
> 
> <!--- MyCustomTag.cfm --->
> <cfparam name="Attributes.outputVariable" type="string"/> 
> <cfset Caller[attributes.outputVariable] = now()/> <cfexit 
> method="exittag"/>

There's nothing inherently unsafe about using a custom tag within a
component, but it appears that your custom tag returns a value to the
component; generally, this kind of logic is better written as a function or
a separate component in its own right.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:271646
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to