apm_source (public)

 apm_source __file [ errorVarName ]

Defined in packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl

Sources $__file in a clean environment, returning 1 if successful or 0 if not. Records that the file has been sourced and stores its mtime in the nsv array apm_library_mtime

Parameters:
__file (required)
errorVarName (optional)

Testcases:
apm_source
Source code:
    if {$errorVarName ne ""} {
        upvar $errorVarName errors
    } else {
        array set errors [list]
    }

    if { ![ad_file exists $__file] } {
        ns_log "Error" "Unable to source $__file: file does not exist."
        return 0
    }

    set r_file [ad_make_relative_path $__file]

    # Actually do the source.
    if { [catch { source $__file } errorMsg] } {
        set backTrace $::errorInfo
        ns_log "Error" "Error sourcing $__file:\n$backTrace"
        set package_key ""
        regexp {/packages/([^/]+)/} $__file -> package_key
        lappend errors($package_key$r_file $backTrace
        return 0
    }

    nsv_set apm_library_mtime $r_file [ad_file mtime $__file]

    return 1
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: