Mark,

That actually won't work--at least it didn't in CF5, I haven't tested in
in CFMX.

The issue is that CF pre-processes the UDF declarations.  Putting a UDF
inside an if(){} statement won't prevent the UDF from being declared
twice and an error erupting.

You have to use a <cfif test><cfinclude udflib></cfif> construct to
avoid the error.

However, I would strongly argue that in CFMX you really should no longer
be using cfinclude'd UDF libraries.  The libraries should be converted
to CFCs.  If you're worried about performance, don't be.  This should be
just as fast as using a CFINCLUDEd UDF lib--Ben Forta recently reported
at a CFUG that internal tests showed calls to a CFC to be faster than a
CFINCLUDE template--but even if using a CFC is slightly slower, the
benefits greatly outweigh the drawbacks (greater code
encapsulation/reuse/documentation vs. very slight loss in performance).

HTH,

Sam


Date: Fri, 27 Sep 2002 15:24:00 -0400
From: "Gaulin, Mark" <[EMAIL PROTECTED]>
Subject: RE: So many problems with CFC scopes...
Message-ID:
<[EMAIL PROTECTED]>

Why not put the "not IsDefined()" test right inside any udf library that
can
potentially be included more than one time?  (Just put the body of the
udf
inside the CFIF block.)

This is like the old "#ifndef _MYFILE_H_", "#define _MYFILE_H_" style
that
is used all the time in C and C++ programming. 
        Mark


______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to