Option 1. Import the library in the pseduo-constructor area of your CFCs. Option 2. Import the library in the method body of any method needing any "global" UDF. Option 3. Create a "root.cfc" (or similar) which all your components extend which imports the UDF library. Option 4. Rewrite your UDF library to make it into component.cfc, from which all components automatically extend.
By "import" I mean either cfinclude or make your udf_library.cfm into UDFLibrary.cfc and change each UDF to be a method. I started down the road of option 3, moved away from it for "abuse of OO principles" reasons, chose option 4, moved away from it for some of the same reasons (and that it seemed too much like a "shotgun" approach), and have settled on option 2. It may seem like a pain to write that createObject statement inside every method that needs a global UDF, but I found that only a few methods in each CFC actually need it, so that was a better approach than option 1. NAT > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Behalf Of Dave Carabetta > Sent: Sunday, October 12, 2003 11:00 AM > To: [EMAIL PROTECTED] > Subject: [CFCDev] Global UDFs in CFCs > > > I did a quick search of the archives and didn't really see anything that > answers this question: what do you guys do with regards to using > global UDFs > in CFCs? For example, we have a site-wide String library of UDFs, and I'd > like to be able to use them in my CFCs, but I'm worried about the coupling > my CFCs would then have to my application environment. At the same time, > though, it doesn't make sense to have two sets of code just because I'm > trying to avoid the coupling issue. How do you guys deal with it? > > Regards, > Dave. > ---------------------------------------------------------- > You are subscribed to cfcdev. To unsubscribe, send an email > to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' > in the message of the email. > > CFCDev is run by CFCZone (www.cfczone.org) and supported > by Mindtool, Corporation (www.mindtool.com). > > An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
