Re: [Activetcl] Sourced from where
by Andreas Kupries other posts by this author
Aug 13 2008 9:05AM messages near this date
view in the new Beta List Site
[Activetcl] Sourced from where
|
Re: [Activetcl] Sourced from where
Wait. I misread 'procedure' as 'package' in my first response :(
For procedures this is not that easy.
In versions of Tcl before 8.5 you cannot get such information at all, except
if you are using some type of debugger (like TclDevKit's tcldebugger) and
have a breakpoint in the procedure in question. Then you run the app, the
debugger stops at the breakpoint, and the label for the code window shows
the path of the file you are in. You will have to load all possible files
into the debugger, and set breakpoints in all of them, of course.
In 8.5+ you can get by without a debugger, by adding a 'puts [info frame]'
to the procedure in question. The output then tells you where the procedure
is from, provided that it was not dynamically defined. This however requires
you to again add the command to all possible files.
--
Andreas Kupries <andreask@[...].com>
Developer @ http://www.ActiveState.com
Tel: +1 778-786-1122
-----Original Message-----
From: activetcl-bounces@[...].com
[mailto:activetcl-bounces@[...].com]On Behalf Of
jonny.schonqvist@[...].com
Sent: Tuesday, August 12, 2008 11:19 PM
To: ActiveTcl@[...].com
Subject: [Activetcl] Sourced from where
Hello All
How could I find out from which file a procedure is loaded (sourced)? We
have a lot of similar scripts with the same name and depending on different
circumstances one is loaded. This works great but when debugging it has
happen some time I'm into the wrong file and do the changes. We are using
the version 8.1 of the interpretator. My intention is to when my application
completes receive a report that proc Blabla where loaded from
\\SERVER1\my\scripts\for\OneState\TheBlablaproc.tcl
Best regards
/Jonny
Thread:
Jonny Schonqvist
Andreas Kupries
Jonny Schonqvist
Andreas Kupries
|