Thanks, Jim. That's good to know.

Hal Helms
See halhelms.com for classes in...
Java for ColdFusion Programmers
Fusebox 4
Mach-II
OO Applications with CFCs

-----Original Message-----
From: Jim Davis [mailto:[EMAIL PROTECTED]
Sent: Friday, October 03, 2003 1:03 AM
To: CF-Talk
Subject: Can't CFRETURN inside include!


Just spent a LONG time trying to figure this out and finally got it.

I've got a set of "Broker" CFCs that handle all of my DB/persistence
layer work.  They, in turn, call out to include files that contain that
actual DB specific code (this is to allow me to easily create a
multi-database capable system - to add a DB you just add a new DBType
and a set of include files).

I was having the Includes represent the "end" of the method processing.
The Broker would contain all of the argument checking and whatnot and
then call out to the Include which would end the method.  (this is
because each data system may fetch/maintain data completely
differently.)

In any case this was working great - while all my methods were operating
on components passed in the arguments (as they mostly do).  I just
created one, however that had a return value.

Placing the CFRETURN tag in the Include resulted in a rather odd error.
It took me a long time to track it down.  In short the CFRETURN tag was
just being plain ignored when in the Include.

Placing the return tag in the method itself solved it (but blows my
coding standard up a bit).

Just a warning if you may be doing the same kind of thing.  This took a
very long time to dig out.  It would be so much better if the CFRETURN
tag threw an error (something like "no return target available" or some
such) as it's obviously just ignored.

Of course this behavior IS in the Macromedia documentation, so it's not
a surprise - I just glossed over it and shouldn't have.

Jim Davis


  _____  


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to