Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TCL Code division

Status
Not open for further replies.

shussai2

Programmer
Aug 28, 2003
42
CA
Hello everyone,

My code (in a single file) is getting bigger and bigger. Is there any way of seperating parts of my code into seperate files yet be able to run my code. ?
 
The most common technique is:
[ul][li]Make sure you use procedures to as great extent as possible, rather than having massive amounts of "in-line" code. This also makes it easier to test individual code bocks on a procedure-by-procedure basis, as well as making it easier to follow the program's logic.[/li]

[li]Group related procedures into separate files.[/li]

[li]Have a "main" application file that sources all the module files, and then begins execution.[/li][/ul]

So, your main application file would end up looking something like:

Code:
source init.tcl
source stats.tcl
source help.tcl

# And then, assuming that you've created a procedure
# called "main" that actually gets the ball rolling,
# just call it.

main

- Ken Jones, President, ken@avia-training.com
Avia Training and Consulting, 866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top