ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> activetcl
activetcl
Re: [Activetcl] Sourced from where
by Andreas Kupries other posts by this author
Aug 13 2008 8:30AM messages near this date
view in the new Beta List Site
Re: [Activetcl] Sourced from where | [Activetcl] Expect doubt.
Assuming that you have loaded/sourced version V of package P via a 'package
require' command you can then do

    package ifneeded P V

to query what script Tcl executed to load/source the package. This script
usually contains the path where it was found.

If the package is not in memory yet you can do

    package ifneeded P [package require P]

taking advantage of the fact that 'require' returns the version it loaded.

If you do not know which version is in memory, but know that the package is
loaded you do

    package ifneeded P [package present P]

Ok, that should cover all the bases.
--
        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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved