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: Andrew Falanga <not_real@hp.com>
Date: Mon Apr 03 2006 - 18:01:46 CEST

Eric Hassold wrote:
> 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/

Thanks for the quick response. I'll make use of this package present.
I had tried using it once before (a while ago) but didn't quite get what
I wanted. However, I can't remember the circumstances at this time and
perhaps I wasn't using it correctly.

Thanks for the help.

---------------------------------------------
Andrew R. Falanga (a non-HP employee)
Hewlett-Packard Company
11311 Chinden Blvd.
Boise, Idaho
---------------------------------------------
Please note: The e-mail address is purposely
mangled. I do not wish my account at HP to
become a spam haven.
Received on Sun Apr 30 02:57:40 2006