My experiments suggest that "apm_first_time_loading" works:
if { [apm_first_time_loading_p] } {
# Append the filter to the list.
nsv_lappend rp_filters . \
[list $priority $kind $method $path $proc $arg $debug $critical $description [info script]]
} else {
# Figure out how to invoke the filter, based on the number of arguments.
if { [llength [info procs $proc]] == 0 } {
# [info procs $proc] returns nothing when the procedure has been
# registered by C code (e.g., ns_returnredirect). Assume that neither
# "conn" nor "why" is present in this case.
set arg_count 1
} else {
set arg_count [llength [info args $proc]]
}
set filter_index {}
ns_register_filter $kind $method $path rp_invoke_filter [list $filter_index $debug $arg_count $proc $arg]
}
I will test this some more and, unless I hear otherwise, commit it to HEAD in a couple of days or so.
Thanks Jeff.