Re: [TCL] Strange behavior, or so I think, for package require
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: [TCL] Strange behavior, or so I think, for package require

From: Eric Hassold <hassold@evolane.fr>
Date: Mon Apr 03 2006 - 17:56:10 CEST

Hi

Andrew Falanga wrote:
> Why? By the time of that third output, the package require cmdline
> hasn't been executed yet so why is it present?

Because, as documented, "package names" returns not only list of the
names of all packages in the interpreter for which a version has
been provided (via package provide), but also those for which a package
ifneeded script is available. Since your package is available in the
auto_path, a "package ifneeded cmdline ...." has been issued from its
pkgIndex.tcl. To test if a package is actually "loaded" into an
interpreter, use "package present cmdline":

if {[catch {package present cmdline} cmdver]} {
   puts "cmdline is not present"
} else {
   puts "cmdline version $cmdver is present"
}

Eric

-----
Eric Hassold
Evolane - http://www.evolane.com/
Received on Sun Apr 30 02:57:40 2006