Re: [Activetcl] Sourced from where
by Jonny Schonqvist other posts by this author
Aug 15 2008 1:12AM messages near this date
view in the new Beta List Site
Re: [Activetcl] Sourced from where
|
Re: [Activetcl] Sourced from where
For your knowledge, I replaced the "source" command, save all loaded proc
names in a list and then list them from a new proc
Thanks
/Jonny
Jonny Sch�nqvist
"Andreas Kupries" <andreask@[...].com>
Sent by: activetcl-bounces@[...].com
2008-08-13 18:05
To
<jonny.schonqvist@[...].com> , <ActiveTcl@[...].com>
cc
Subject
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
_______________________________________________
ActiveTcl mailing list
ActiveTcl@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Jonny Schonqvist
Andreas Kupries
Jonny Schonqvist
Andreas Kupries
|