'proc unknown' causes package error 
Author Message
 'proc unknown' causes package error

with tcl8.2.3 on solaris, if I have 2 files,
# good.tcl
package require Expect

and :
# bad.tcl
proc unknown {args} {
# catch unknown commands
  puts "bad command: $args"

Quote:
}

package require Expect

The file with the 'unknown' proc. shows the error:
$ tcl bad.tcl
bad command: tclPkgUnknown Expect {}
can't find package Expect
    while executing
"package require Expect"
    (file "bad.tcl" line 5)

Is the unknown proc an antiquated feature that now causes problems?

Please copy an email to me.

Thanks!

Robert Karen



Sat, 04 Jan 2003 03:00:00 GMT  
 'proc unknown' causes package error

Quote:
> proc unknown {args} {
> # catch unknown commands
>   puts "bad command: $args"
> }

By redefining [unknown] this way, you are disabling Tcl's auto-loader.
Since release 8.1, Tcl has used the auto-loader to load portions of its
script library.  Do you really need to disable the auto-loader?

If you do, you should do the following before redefining [unknown]:

        foreach f [glob [file join [info library] *.tcl]] {
            source $f
        }

That will force the loading of Tcl's script library before the
auto-loader goes away.  However, it will not take care of any extensions
(Tk?) which might also depend on Tcl's auto-loader.

Do you really need to disable the auto-loader?

Quote:
> $ tcl bad.tcl
> bad command: tclPkgUnknown Expect {}
...
> Is the unknown proc an antiquated feature that now causes problems?

--
| Don Porter          Mathematical and Computational Sciences Division |

| http://math.nist.gov/~DPorter/                                  NIST |
|______________________________________________________________________|


Sat, 04 Jan 2003 03:00:00 GMT  
 'proc unknown' causes package error
Looks like it works perfectly to me

You might like to try the command:

info body unknown

Regards Paul Nash



Sun, 05 Jan 2003 03:00:00 GMT  
 'proc unknown' causes package error
what you want is:

set oldUnknownExists [expr {[catch {rename unknown old_unknown}] != 1}]
proc unknown args {
    variable oldUnknownExists

    if {$oldUnknownExists} {
        eval old_unknown $args
    }

    ## other stuff

Quote:
}

so you don't overwrite the original unknown proc.

-kl


Quote:
> with tcl8.2.3 on solaris, if I have 2 files,
> # good.tcl
> package require Expect

> and :
> # bad.tcl
> proc unknown {args} {
> # catch unknown commands
>   puts "bad command: $args"
> }
> package require Expect

> The file with the 'unknown' proc. shows the error:
> $ tcl bad.tcl
> bad command: tclPkgUnknown Expect {}
> can't find package Expect
>     while executing
> "package require Expect"
>     (file "bad.tcl" line 5)

> Is the unknown proc an antiquated feature that now causes problems?

> Please copy an email to me.

> Thanks!

> Robert Karen



Sun, 05 Jan 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Timesaver error: Unknown Variable '%TS'

2. What causes 'Internal error 5333'?

3. 'after' causes illegal instruction errors

4. using the opt package for itcl's method and proc

5. What is the cause of this error (Memory block free'd twice)

6. ERROR 48 - what's the cause?

7. Problems building exe that includes dsc (vi's always in memory, causing an error)

8. Problems building exe that includes dsc (vi's always in memory, causing an error)

9. NT HELP: \'s seem to be causing error with SGML

10. Unknown Variable '%AppTemplateFamily'

11. OPEN(..,..,STATUS='UNKNOWN') with Watcom F77

12. Problem with 'unknown'?

 

 
Powered by phpBB® Forum Software