#275 no return value from ns_adp_include

aolserver_v45
open
nobody
API: Tcl (36)
5
2007-01-20
2007-01-20
No

The ns_adp_include proc in AOLserver 4.0.* used to return the value from an included inc file e.g.

file: main.adp

set time [ns_adp_include clock.inc]

file: clock.inc:

ns_adp_return [clock seconds]

The bug stems from the tcl proc ns_adp_include which is defined in nsd/tclcmds.c (why?) like so:

proc ns_adp_include {args} {
if [catch {eval _ns_adp_include $args} errMsg] {
return -code error $errMsg
}
return -code ok
}

which, as you can see, will not return the result.

The best way to fix this, would be to remove this proc definition from the C code, and put into one of the tcl files in the modules/tcl directory, with a proc definition like this:

proc ns_adp_include {args} {
set code [catch [linsert $args 0 _ns_adp_include] return]
return -code $code $return
}

Using this construct is the most efficient way to wrap one command within another.

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks