Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tcl question - how to list functions in a namespace

Tags:

namespaces

tcl

I am trying to list all of the functions a namespace has in it (warning - I'm really new to Tcl, so I'll probably use the wrong words for parts of Tcl). For example, I have a tcl shell someone compiled for me (if that's the right way to phrase it), and I know at least one function exists, let's call it

blah::do_something

I know in ruby there are ways to list all the functions in a module/namespace. How would I find out what other functions are available in the blah namespace in Tcl?

Thanks in advance

like image 660
Bub Bradlee Avatar asked May 21 '10 23:05

Bub Bradlee


2 Answers

You use [info commands] to query what commands are available, and you can scope it to a particular namespace by specifying a glob-style pattern. For example:

% info commands ::blah::*
::blah::do_something
like image 92
Eric Melski Avatar answered Jan 05 '23 11:01

Eric Melski


Also: namespace eval ::blah {info procs}

like image 41
glenn jackman Avatar answered Jan 05 '23 11:01

glenn jackman