Forum OpenACS Q&A: Re: namespace procs and the query dispatcher

Posted by Roberto Mello on

We (I and Michael Cleverly) kept discussing the problem in IRC until we came up with a simple solution:

    set proc_name_as_passed $proc_name
    set proc_namespace [uplevel {::namespace current}]
    if { $proc_namespace != "::" } {
        regsub {^::} $proc_namespace {} proc_namespace
        set proc_name "${proc_namespace}::${proc_name}"

    } elseif { [string match ::* $proc_name] } {
        # RBM: 2003-01-26: For procs declared like ::foo::bar, we only trim
        #                  the first :: 
        set proc_name [string trimleft $proc_name ::]

I'm committing this to 4.6 and will try to merge with HEAD. I've tested and works fine.

During our adventure through the QD and ad_proc code, we saw several places where code could be made more efficient, like using string map. We're trying to fix some of those things.