I think I forgot some other problems with CFCs linked to UDF lib functions.
It took me sometime to understand why I was not able to include UDF lib in
some cases.

- CFC methods defined in an included file cannot really include UDF lib.
Indeed, CF refuses to include twice the same UDF lib in one single script,
which could be the case with two CFC included methods definition that use
the same UDF lib.
WORKAROUND : include the UDF lib at the top of the CFC before the
<CFFunction> method tags (even if only few methods of the CFC use it). But I
don't know if this is very nice for the CFC, especially if the UDF lib is
based on <cffunction> tag which the same than the one used to define CFC
methods...

- UDF lib cannot be included in a CFC if the UDF lib is already included in
the script calling the CFC. This is a problem : if you want to use the CFC
in another script, you have to think to include the UDF lib before to invoke
the CFC...
WORKAROUND : use the <cfif isDefined("oneOfTheFunctionName")><cfinclude
template="myUDFlib.cfm"></cfif> in the CFC to test if the UDF lib has
already be included.

All this is not very clean...
I wonder if it could be possible that CF accept to include several times the
same UDF lib : if it is the same file, it should not complain about it.
It would solve all those problems.

Any other CFC problems + workaround comes to your mind?


Benoit Hediard
http://www.benorama.com



-----Message d'origine-----
De : Benoit Hediard [mailto:[EMAIL PROTECTED]]
Envoyé : jeudi 26 septembre 2002 20:32
À : CF-Talk
Objet : So many problems with CFC scopes...


Hi,

I was wondering if anyone know when MM is going to fix all the issues
related to CFC scopes.
I was hoping for the CFMX updater, but it hasn't solve anything on those
issues.

It makes CFC development very weird, you need to use many workarounds,
especially when includes are used for methods definition.

Issues :
- CFCs used in persistent scope (session, application...) loose the page
context and cannot access other persistent scopes variables.
WORKAROUND :
http://webforums.macromedia.com/coldfusion/messageview.cfm?catid=8&threadid=
386634

- The "variable." scope is not private.
WORKAROUND : use the un-named scope
(http://cfguru.daemon.com.au/archives/000067.html)

- methods defined in an included file loose the argument scope,
WORKAROUND : put the 'argument' scope in 'request' or 'this' scope to pass
it to the included method

- methods defined in an included file cannot call "private" or "package"
methods of the same CFC,
WORKAROUND : use only "public" or "remote" access security... :(

Any other problems related to CFC scopes to your mind or better workarounds?


Benoit Hediard
http://www.benorama.com


______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.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