Forum OpenACS Q&A: Re: Problems defining procs

Collapse
Posted by ultra newb on
Update: Created a package for everything. I still have the same problems with the package.

Here is the exchange-procs.tcl file:

proc ret x {return $x}

proc exch cmd {
set EXCH_HOST [ad_host]
set EXCH_PORT 9999

set socket [socket $EXCH_HOST $EXCH_PORT]
puts -nonewline $socket $cmd
flush $socket

set reply {}
while {[set line [string trim [gets $socket]]] != {}} {
lappend reply $line
}
close $socket
return $reply
}

proc libdir {} {return [get_server_root]/packages/acs-subsite/lib}
util_memoize libdir

proc mkt {} {return [lindex [list [lrange [lindex [exch MKT] 0] 1 end]] 0]}
util_memoize mkt

proc mktmin {} {
return [lindex [exch MKMIN,MKMAX] 0]
}

As stated previously, it depends on the postition of various procs as to whether this works or not. I had rearranged things and had everything working up until I added the last proc (mktmin), which caused it to blow up again.